diff --git a/engine/function/users.php b/engine/function/users.php index a267154..cc77f7f 100644 --- a/engine/function/users.php +++ b/engine/function/users.php @@ -1173,11 +1173,12 @@ function user_create_account($register_data, $maildata) { $account_id = user_id($register_data['name']); $activeKey = rand(100000000,999999999); - mysql_insert("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`, `activekey`, `flag`) VALUES ('$account_id', '$ip', '$created', '$activeKey', '$flag')"); + $active = ($maildata['register']) ? 0 : 1; + mysql_insert("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`, `active`, `activekey`, `flag`) VALUES ('$account_id', '$ip', '$created', '$active', '$activeKey', '$flag')"); if ($maildata['register']) { - $thisurl = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + $thisurl = config('site_url') . "$_SERVER[REQUEST_URI]"; $thisurl .= "?authenticate&u=".$account_id."&k=".$activeKey; $mailer = new Mail($maildata); diff --git a/layout/widgets/login.php b/layout/widgets/login.php index eb1869c..1e16d7f 100644 --- a/layout/widgets/login.php +++ b/layout/widgets/login.php @@ -23,7 +23,7 @@ Token::create(); ?>
If you really want to remove Two-Factor Authentication, click on the following link:
";
+ $body .= "$recoverylink
";
+ $body .= "Enjoy your stay at ".$config['mailserver']['fromName'].".
";
+ $body .= "
We have sent a confirmation link to .
+You must click the link before we remove Two-factor authentication.
+If you can't find the email within 5 minutes, check your junk/trash inbox as it may be mislocated there.
+ +Submitted data is wrong.
+ -Do you wish to recover your username, password or remove Two-factor authentication?
+ +Do you wish to recover your username or password?
- - - -Do you wish to recover your username or password?
-We have sent you an email with an activation link to your submitted email address.
-If you can't find the email within 5 minutes, check your junk/trash inbox as it may be mislocated there.
+If you can't find the email within 5 minutes, check your junk/trash inbox (spam filter) as it may be mislocated there.
0) ? (int)$_GET['u'] : false; $akey = (isset($_GET['k']) && (int)$_GET['k'] > 0) ? (int)$_GET['k'] : false; // Find a match - $user = mysql_select_single("SELECT `id` FROM `znote_accounts` WHERE `account_id`='$auid' AND `activekey`='$akey' AND `active`='0' LIMIT 1;"); + $user = mysql_select_single("SELECT `id`, `active` FROM `znote_accounts` WHERE `account_id`='$auid' AND `activekey`='$akey' LIMIT 1;"); if ($user !== false) { $user = $user['id']; + $active = $user['active']; // Enable the account to login - mysql_update("UPDATE `znote_accounts` SET `active`='1' WHERE `id`='$user' LIMIT 1;"); + if ($active == 0) { + mysql_update("UPDATE `znote_accounts` SET `active`='1' WHERE `id`='$user' LIMIT 1;"); + } echo 'Your account has been created. You may now login to create a character.
'; } else { echo 'Either the activation link is wrong, or your account is already activated.
';