Skip to content

Commit 4ccb8ee

Browse files
committed
Add referrer for registration
1 parent 2c22f0e commit 4ccb8ee

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

dbSetup.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-- https://www.phpmyadmin.net/
44
--
55
-- Host: localhost
6-
-- Generation Time: Jul 19, 2016 at 04:25 AM
6+
-- Generation Time: Jul 25, 2016 at 06:49 PM
77
-- Server version: 5.7.13
88
-- PHP Version: 5.5.36
99

@@ -217,7 +217,7 @@ CREATE TABLE `user` (
217217
`timezone` double(3,1) NOT NULL,
218218
`results` int(11) NOT NULL DEFAULT '0',
219219
`lifetime` int(11) NOT NULL DEFAULT '0',
220-
`referrer` mediumtext COLLATE utf8_unicode_ci
220+
`referrer` text COLLATE utf8_unicode_ci
221221
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
222222

223223
--

routes/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ router.get('/search', (req, res, next) => {
120120
});
121121

122122
router.post('/register', (req, res, next) => {
123-
if (missingProps(req.body, ['username', 'password', 'timezone', 'g-recaptcha-response']) && process.env.spec !== "true") {
123+
if (missingProps(req.body, ['username', 'password', 'timezone', 'referrer', 'g-recaptcha-response']) && process.env.spec !== "true") {
124124
req.flash('warning', 'Missing expected form properties');
125125
res.redirect(baseURL + '/register');
126126
return;
@@ -147,7 +147,7 @@ router.post('/register', (req, res, next) => {
147147
let json = JSON.parse(body);
148148

149149
if (json.success === true || process.env.spec === "true") {
150-
User.register({username: req.body.username, password: req.body.password, timezone: req.body.timezone}).then(data => {
150+
User.register({username: req.body.username, password: req.body.password, referrer: req.body.referrer, timezone: req.body.timezone}).then(data => {
151151
req.session.loggedin = true;
152152
req.session.user = data.user;
153153

views/pages/register.ejs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
<option value="10.0">(GMT +10:00) Eastern Australia, Guam, Vladivostok</option>
4747
<option value="11.0">(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option>
4848
<option value="12.0">(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option>
49-
</select>
49+
</select><br>
50+
<textarea name="referrer" row="5" cols="40" placeholder="How did you hear about us?" maxlength='65535'></textarea>
5051
<div class='recaptcha'>
5152
<div class="g-recaptcha" data-sitekey="<%=recaptcha%>"></div>
5253
</div>

0 commit comments

Comments
 (0)