[ADDED] Accept TaC during registration

This commit is contained in:
Sebastian Grewe 2013-12-12 10:11:44 +01:00
parent 9338af0d31
commit f465bda350
3 changed files with 38 additions and 29 deletions

View File

@ -456,8 +456,12 @@ class User extends Base {
* @param email2 string Email confirmation * @param email2 string Email confirmation
* @return bool * @return bool
**/ **/
public function register($username, $password1, $password2, $pin, $email1='', $email2='', $strToken='') { public function register($username, $password1, $password2, $pin, $email1='', $email2='', $tac='', $strToken='') {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
if ($tac != 1) {
$this->setErrorMessage('You need to accept our <a href="'.$_SERVER['PHP_SELF'].'?page=tac" target="_blank">Terms and Conditions</a>');
return false;
}
if (strlen($username) > 40) { if (strlen($username) > 40) {
$this->setErrorMessage('Username exceeding character limit'); $this->setErrorMessage('Username exceeding character limit');
return false; return false;

View File

@ -23,7 +23,7 @@ if ($setting->getValue('disable_invitations') && $setting->getValue('lock_regist
if ($rsp->is_valid) { if ($rsp->is_valid) {
$smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key'))); $smarty->assign("RECAPTCHA", recaptcha_get_html($setting->getValue('recaptcha_public_key')));
isset($_POST['token']) ? $token = $_POST['token'] : $token = ''; isset($_POST['token']) ? $token = $_POST['token'] : $token = '';
if ($user->register(@$_POST['username'], @$_POST['password1'], @$_POST['password2'], @$_POST['pin'], @$_POST['email1'], @$_POST['email2'], $token)) { if ($user->register(@$_POST['username'], @$_POST['password1'], @$_POST['password2'], @$_POST['pin'], @$_POST['email1'], @$_POST['email2'], @$_POST['tac'], $token)) {
! $setting->getValue('accounts_confirm_email_disabled') ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login'); ! $setting->getValue('accounts_confirm_email_disabled') ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login');
} else { } else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'errormsg'); $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'errormsg');
@ -39,7 +39,7 @@ if ($setting->getValue('disable_invitations') && $setting->getValue('lock_regist
// Captcha disabled // Captcha disabled
} else { } else {
isset($_POST['token']) ? $token = $_POST['token'] : $token = ''; isset($_POST['token']) ? $token = $_POST['token'] : $token = '';
if ($user->register(@$_POST['username'], @$_POST['password1'], @$_POST['password2'], @$_POST['pin'], @$_POST['email1'], @$_POST['email2'], $token)) { if ($user->register(@$_POST['username'], @$_POST['password1'], @$_POST['password2'], @$_POST['pin'], @$_POST['email1'], @$_POST['email2'], @$_POST['tac'], $token)) {
! $setting->getValue('accounts_confirm_email_disabled') ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login'); ! $setting->getValue('accounts_confirm_email_disabled') ? $_SESSION['POPUP'][] = array('CONTENT' => 'Please check your mailbox to activate this account') : $_SESSION['POPUP'][] = array('CONTENT' => 'Account created, please login');
} else { } else {
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'errormsg'); $_SESSION['POPUP'][] = array('CONTENT' => 'Unable to create account: ' . $user->getError(), 'TYPE' => 'errormsg');

View File

@ -25,14 +25,19 @@
</fieldset> </fieldset>
<fieldset> <fieldset>
<label>PIN</label> <label>PIN</label>
<input type="password" class="text pin" name="pin" value="" size="4" maxlength="4"><font size="1"> (4 digit number. <b>Remember this pin!</b>)</font> <input type="password" class="text pin" name="pin" value="" size="4" maxlength="4" required><font size="1"> (4 digit number. <b>Remember this pin!</b>)</font>
</fieldset> </fieldset>
{nocache}{$RECAPTCHA|default:""}{/nocache} {nocache}{$RECAPTCHA|default:""}{/nocache}
<fieldset>
<label>Terms and Conditions</label><font size="1">&nbsp;Accept Terms and Conditions</font>
<input type="checkbox" value="1" name="tac" id="tac">
<label for="tac"></label>
</fieldset>
</div>
<footer> <footer>
<div class="submit_link"> <div class="submit_link">
<input type="submit" value="Register" class="alt_btn"> <input type="submit" value="Register" class="alt_btn">
</div> </div>
</footer> </footer>
</form> </form>
</div>
</article> </article>