diff -r 0ae1b281a884 -r af0f6ec48de3 plugins/SpecialUserFuncs.php --- a/plugins/SpecialUserFuncs.php Mon Sep 17 11:52:58 2007 -0400 +++ b/plugins/SpecialUserFuncs.php Tue Sep 18 00:30:43 2007 -0400 @@ -333,6 +333,12 @@ function page_Special_Register() { global $db, $session, $paths, $template, $plugins; // Common objects + + // form field trackers + $username = ''; + $email = ''; + $realname = ''; + if(getConfig('account_activation') == 'disable' && ( ( $session->user_level >= USER_LEVEL_ADMIN && !isset($_GET['IWannaPlayToo']) ) || $session->user_level < USER_LEVEL_ADMIN || !$session->user_logged_in )) { $s = ($session->user_level >= USER_LEVEL_ADMIN) ? '
Oops...it seems that you are the administrator...hehe...you can also force account registration to work.
' : ''; @@ -360,9 +366,38 @@ else { $coppa = ( isset($_POST['coppa']) && $_POST['coppa'] == 'yes' ); + $s = false; + + // decrypt password + // as with the change pass form, we aren't going to bother checking the confirmation code because if the passwords didn't match + // and yet the password got encrypted, that means the user screwed with the code, and if the user screwed with the code and thus + // forgot his password, that's his problem. + + if ( $_POST['use_crypt'] == 'yes' ) + { + $aes = new AESCrypt(AES_BITS, AES_BLOCKSIZE); + $crypt_key = $session->fetch_public_key($_POST['crypt_key']); + if ( !$crypt_key ) + { + $s = 'Couldn\'t look up public encryption key'; + } + else + { + $data = $_POST['crypt_data']; + $bin_key = hexdecode($crypt_key); + //die("Decrypting with params: key $crypt_key, data $data"); + $password = $aes->decrypt($data, $bin_key, ENC_HEX); + } + } + else + { + $password = $_POST['password']; + } // CAPTCHA code was correct, create the account - $s = $session->create_user($_POST['username'], $_POST['password'], $_POST['email'], $_POST['real_name'], $coppa); + // ... and check for errors returned from the crypto API + if ( !$s ) + $s = $session->create_user($_POST['username'], $password, $_POST['email'], $_POST['real_name'], $coppa); } } if($s == 'success' && !$coppa) @@ -387,6 +422,9 @@ $str = 'However, in compliance with the Childrens\' Online Privacy Protection Act, you must have your parent or legal guardian activate your account. Please ask them to check their e-mail for further information.'; die_friendly('Registration successful', 'Thank you for registering, your user account has been created. '.$str.'
'); } + $username = htmlspecialchars($_POST['username']); + $email = htmlspecialchars($_POST['email']); + $realname = htmlspecialchars($_POST['real_name']); } $template->header(); echo 'A user account enables you to have greater control over your browsing experience.'; @@ -396,9 +434,13 @@ $coppa = ( isset($_GET['coppa']) && $_GET['coppa'] == 'yes' ); $session->kill_captcha(); $captchacode = $session->make_captcha(); + + $pubkey = $session->rijndael_genkey(); + $challenge = $session->dss_rand(); + ?>