diff options
Diffstat (limited to 'account.php')
-rw-r--r-- | account.php | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/account.php b/account.php index 9b5ad6a3f..babbd5921 100644 --- a/account.php +++ b/account.php @@ -24,7 +24,7 @@ function account_email() { function account_create($error = "") { global $theme; - + if ($error) { $output .= "<P><FONT COLOR=\"red\">". t("Failed to create account") .": ". check_output($error) .".</FONT></P>\n"; watchdog("account", "failed to create account: $error."); @@ -133,7 +133,7 @@ function account_site_edit() { } else { $theme->header(); - $theme->box(t("Create user account"), account_create()); + if (variable_get("account_reg_allow", 1)) $theme->box(t("Create user account"), account_create()); $theme->box(t("E-mail new password"), account_email()); $theme->footer(); } @@ -216,29 +216,12 @@ function account_user($uname) { else { // Display login form: $theme->header(); - $theme->box(t("Create user account"), account_create()); + if (variable_get("account_reg_allow", 1)) $theme->box(t("Create user account"), account_create()); $theme->box(t("E-mail new password"), account_email()); $theme->footer(); } } -function account_validate($user) { - // Verify username and e-mail address: - if (empty($user[real_email]) || (!check_mail($user[real_email]))) $error = t("the e-mail address '$user[real_email]' is not valid"); - if (empty($user[userid]) || (!check_name($user[userid]))) $error = t("the username '$user[userid]' is not valid"); - if (strlen($user[userid]) > 15) $error = t("the username '$user[userid]' is too long: it must be less than 15 characters"); - - // Check to see whether the username or e-mail address are banned: - if ($ban = user_ban($user[userid], "username")) $error = t("the username '$user[userid]' is banned") .": <I>$ban->reason</I>"; - if ($ban = user_ban($user[real_email], "e-mail address")) $error = t("the e-mail address '$user[real_email]' is banned") .": <I>$ban->reason</I>"; - - // Verify whether username and e-mail address are unique: - if (db_num_rows(db_query("SELECT userid FROM users WHERE LOWER(userid) = LOWER('$user[userid]')")) > 0) $error = t("the username '$user[userid]' is already taken"); - if (db_num_rows(db_query("SELECT real_email FROM users WHERE LOWER(real_email) = LOWER('$user[real_email]')")) > 0) $error = t("the e-mail address '$user[real_email]' is already in use by another account"); - - return $error; -} - function account_email_submit($userid, $email) { global $theme; @@ -334,13 +317,6 @@ function account_create_confirm($name, $hash) { $theme->footer(); } -function account_password($min_length=6) { - mt_srand((double)microtime() * 1000000); - $words = array("foo","bar","guy","neo","tux","moo","sun","asm","dot","god","axe","geek","nerd","fish","hack","star","mice","warp","moon","hero","cola","girl","fish","java","perl","boss","dark","sith","jedi","drop","mojo"); - while(strlen($password) < $min_length) $password .= $words[mt_rand(0, count($words))]; - return $password; -} - function account_track_comments() { global $theme, $user; @@ -429,7 +405,7 @@ switch ($op) { account_email_submit(check_input($userid), check_input($email)); break; case t("Create account"): - account_create_submit(check_input($userid), check_input($email)); + if (variable_get("account_reg_allow", 1)) account_create_submit(check_input($userid), check_input($email)); break; case t("Save user information"): account_user_save($edit); |