From 76a6bad6b5015a0b25c0739ac86b7ca0e0620be6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 28 Sep 2011 20:49:24 -0700 Subject: Force users to give an email address when they create an account. --- src/controllers/Users.class.php | 5 +++++ src/views/pages/users/new.html.php | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php index 52fd33c..57a585c 100644 --- a/src/controllers/Users.class.php +++ b/src/controllers/Users.class.php @@ -138,6 +138,7 @@ class Users extends Controller { @$vars['username' ] = $_POST['auth_name']; @$vars['password1'] = $_POST['auth_password' ]; @$vars['password2'] = $_POST['auth_password_verify']; + @$vars['email'] = $_POST['user_email']; $vars['errors'] = array(); if ($db->getUID($vars['username'])!==false) @@ -151,6 +152,9 @@ class Users extends Controller { if ($matches && $vars['password2'] == '') { $vars['errors'][] = 'no pw'; } + if ($vars['email'] == '') { + $vars['errors'][] = 'no email'; + } foreach ($pm->callHook('antispam_verify') as $plugin=>$valid) { if (!$valid) $vars['errors'][] = 'plugin_'.$plugin; } @@ -165,6 +169,7 @@ class Users extends Controller { $this->showView('users/500'); } else { Login::login($username, $password); + $this->setConf($uid, 'email', $vars['email']); $this->showView('users/created', array('username'=>$username)); } diff --git a/src/views/pages/users/new.html.php b/src/views/pages/users/new.html.php index 62a0f09..8b6bdf8 100644 --- a/src/views/pages/users/new.html.php +++ b/src/views/pages/users/new.html.php @@ -28,6 +28,12 @@ if (in_array('no pw', $VARS['errors'])) { $password = ''; } $t->inputNewPassword('auth_password','Password', $password); + +if (in_array('no email', $VARS['errors'])) { + $t->inputP("You must provide an email address.", true); +} +$t->inputText('user_email', 'Email Address', + 'This is so that we can contact you. (duh).', $VARS['email']); $t->closeFieldset(); foreach ($VARS['antispam_html'] as $html) { -- cgit v1.2.3