. // functions related to account creation and login: // - forms for create / login // - function to make login token // If have recent token, return it. // Else make login token, store in user record, return token // function make_login_token($user) { $now = time(); if ($now - $user->login_token_time < 86400) { return $user->login_token; } $token = substr(random_string(), 0, 8); $user->update("login_token='$token', login_token_time=$now"); return $token; } // return HTML string for a checkbox for toggling password visibility // function passwd_visible_checkbox($name) { return sprintf(' Show password ', $name ); } function create_account_form($teamid, $next_url) { global $recaptcha_public_key; form_input_hidden('next_url', $next_url); if ($teamid) { form_input_hidden('teamid', $teamid); } // Using invitation codes to restrict access? // if (defined('INVITE_CODES')) { form_input_text( sprintf('%s', tra("An invitation code is required to create an account."), tra("Invitation code") ), "invite_code" ); } form_input_text( sprintf('%s', tra("Identifies you on our web site. Use your real name or a nickname."), tra("Screen name") ), "new_name" ); form_input_text( sprintf('%s', tra("Must be a valid address of the form 'name@domain'."), tra("Email address") ), "new_email_addr" ); $min_passwd_length = parse_element(get_config(), ""); if (!$min_passwd_length) { $min_passwd_length = 6; } form_input_text( sprintf('%s', tra("Must be at least %1 characters", $min_passwd_length), tra("Password") ), "passwd", "", "password" ); form_input_text(tra("Confirm password"), "passwd2", "", "password"); form_select( sprintf('%s', tra("Select the country you want to represent, if any."), tra("Country") ), "country", country_select_options() ); if (POSTAL_CODE) { form_input_text( tra("Postal or ZIP Code")."
".tra("Optional")."", "postal_code" ); } } function login_form($next_url) { form_start(secure_url_base()."/login_action.php", "post"); form_input_hidden("next_url", $next_url); if (LDAP_HOST) { $x = "Email address or LDAP user name:"; } else { $x = tra("Email address:"); } form_input_text($x, "email_addr"); form_input_text( tra("Password:").'
' . tra("forgot password?") . "", "passwd", "", "password", 'id="passwd"', passwd_visible_checkbox("passwd") ); form_checkboxes(tra("Stay logged in"), array(array("stay_logged_in", "", true)) ); form_submit("Log in"); form_end(); } ?>