29 August 2005 * * @package webtrees * @subpackage Admin * @version $Id$ */ define('WT_SCRIPT_NAME', 'login_register.php'); require './includes/session.php'; require WT_ROOT.'includes/functions/functions_edit.php'; $REQUIRE_ADMIN_AUTH_REGISTRATION=get_site_setting('REQUIRE_ADMIN_AUTH_REGISTRATION'); $action =safe_POST('action'); $user_realname =safe_POST('user_realname'); $url =safe_POST('url', WT_REGEX_URL, 'index.php'); $time =safe_POST('time'); $user_name =safe_POST('user_name', WT_REGEX_USERNAME); $user_email =safe_POST('user_email', WT_REGEX_EMAIL); $user_password01=safe_POST('user_password01', WT_REGEX_PASSWORD); $user_password02=safe_POST('user_password02', WT_REGEX_PASSWORD); $user_language =safe_POST('user_language', array_keys(i18n::installed_languages()), WT_LOCALE); $user_gedcomid =safe_POST('user_gedcomid'); $user_comments =safe_POST('user_comments'); $user_password =safe_POST('user_password'); $user_hashcode =safe_POST('user_hashcode'); if (empty($action)) $action = safe_GET('action'); if (empty($user_name)) $user_name = safe_GET('user_name', WT_REGEX_USERNAME); if (empty($user_hashcode)) $user_hashcode = safe_GET('user_hashcode'); $message=""; switch ($action) { case "pwlost" : print_header(i18n::translate('Lost password request')); ?>
An email with your new password was sent to the address we have on file for %s. Please check your email account; you should receive our message soon. Recommendation: You should login to this site with your new password as soon as possible, and you should change your password to maintain your data\'s security.', $user_name);?> |
| ";
echo i18n::translate(' Notice: By completing and submitting this form, you agree: ');
echo "
"; echo " |
| Thank you for your registration.', $user_realname); ?> %s. You must verify your account request by following instructions in the confirmation email. If you do not confirm your account request within seven days, your application will be rejected automatically. You will have to apply again. After you have followed the instructions in the confirmation email, the administrator still has to approve your request before your account can be used. To login to this site, you will need to know your user name and password.', $user_email); else print i18n::translate('We will now send a confirmation email to the address %s. You must verify your account request by following instructions in the confirmation email. If you do not confirm your account request within seven days, your application will be rejected automatically. You will have to apply again. After you have followed the instructions in the confirmation email, you can login. To login to this site, you will need to know your user name and password.', $user_email); ?> |
| ".i18n::translate('User verification')." |
| ";
print i18n::translate('The data for the user %s was checked.', $user_name);
if ($user_id) {
$pw_ok = (get_user_password($user_id) == crypt($user_password, get_user_password($user_id)));
$hc_ok = (get_user_setting($user_id, 'reg_hashcode') == $user_hashcode);
if (($pw_ok) && ($hc_ok)) {
set_user_setting($user_id, 'verified', 1);
set_user_setting($user_id, 'pwrequested', null);
set_user_setting($user_id, 'reg_timestamp', date("U"));
set_user_setting($user_id, 'reg_hashcode', null);
if (!$REQUIRE_ADMIN_AUTH_REGISTRATION) {
set_user_setting($user_id, 'verified_by_admin', 1);
}
AddToLog("User verified: ".$user_name, 'auth');
// switch language to webmaster settings
$webmaster_user_id=get_gedcom_setting(WT_GED_ID, 'WEBMASTER_USER_ID');
i18n::init(get_user_setting($webmaster_user_id, 'language'));
$mail_body = "";
$mail_body .= i18n::translate('Hello Administrator ...') . "\r\n\r\n";
$mail_body .= i18n::translate('User %s (%s) has confirmed his request for an account.', $user_name, getUserFullName($user_id)) . "\r\n\r\n";
if ($REQUIRE_ADMIN_AUTH_REGISTRATION) $mail_body .= i18n::translate('Please click on the link below to login to your site. You must Edit the user to activate the account so that he can login to your site.') . "\r\n";
else $mail_body .= i18n::translate('You do not have to take any action; the user can now login.') . "\r\n";
if ($TEXT_DIRECTION=="rtl") {
$mail_body .= "";
}
$mail_body .= WT_SERVER_NAME.WT_SCRIPT_PATH."useradmin.php?action=edituser&username=" . urlencode($user_name);
if ($TEXT_DIRECTION=="rtl") $mail_body .= "";
$mail_body .= "\r\n";
$message = array();
$message["to"]=get_user_name($webmaster_user_id);
$message["from"]=$WEBTREES_EMAIL;
$message["subject"] = i18n::translate('New user at %s', WT_SERVER_NAME.WT_SCRIPT_PATH);
$message["body"] = $mail_body;
$message["created"] = $time;
$message["method"] = get_user_setting($webmaster_user_id, 'CONTACT_METHOD');
addMessage($message);
i18n::init(WT_LOCALE); // Reset language
print " ".i18n::translate('You have confirmed your request to become a registered user.')." "; if ($REQUIRE_ADMIN_AUTH_REGISTRATION) print i18n::translate('The Administrator has been informed. As soon as he gives you permission to login, you can login with your user name and password.'); else print i18n::translate('You can now login with your user name and password.'); print " |