mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 17:54:55 +02:00
Refactor
Add missing password check Formatting
This commit is contained in:
@@ -5,11 +5,12 @@ csrfProtect();
|
||||
|
||||
$title = 'Lost Account';
|
||||
|
||||
$newPassword = $_REQUEST['passor'];
|
||||
$newPassword = $_REQUEST['password'];
|
||||
$passwordRepeat = $_REQUEST['password_repeat'];
|
||||
$code = $_REQUEST['code'];
|
||||
$character = stripslashes($_REQUEST['character']);
|
||||
|
||||
if(empty($code) || empty($character) || empty($newPassword)) {
|
||||
if(empty($code) || empty($character) || empty($newPassword) || empty($passwordRepeat)) {
|
||||
$errors[] = 'Please enter code from e-mail and name of one character from account. Then press Submit.';
|
||||
|
||||
$twig->display('error_box.html.twig', [
|
||||
@@ -34,9 +35,10 @@ if($player->isLoaded()) {
|
||||
|
||||
if($account->isLoaded()) {
|
||||
if($account->getCustomField('email_code') == $code) {
|
||||
if(Validator::password($newPassword)) {
|
||||
if ($newPassword == $passwordRepeat) {
|
||||
if (Validator::password($newPassword)) {
|
||||
$tmp_new_pass = $newPassword;
|
||||
if(USE_ACCOUNT_SALT) {
|
||||
if (USE_ACCOUNT_SALT) {
|
||||
$salt = generateRandomString(10, false, true, true);
|
||||
$tmp_new_pass = $salt . $newPassword;
|
||||
$account->setCustomField('salt', $salt);
|
||||
@@ -52,10 +54,9 @@ if($account->isLoaded()) {
|
||||
]);
|
||||
|
||||
$statusMsg = '';
|
||||
if(_mail($account->getCustomField('email'), configLua('serverName') . ' - Your new password', $mailBody)) {
|
||||
if (_mail($account->getCustomField('email'), configLua('serverName') . ' - Your new password', $mailBody)) {
|
||||
$statusMsg = '<br /><small>New password work! Sent e-mail with your password and account name. You should receive this e-mail in 15 minutes. You can login now with new password!';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$statusMsg = '<br /><p class="error">New password work! An error occurred while sending email! You will not receive e-mail with new password. For Admin: More info can be found in system/logs/mailer-error.log';
|
||||
}
|
||||
|
||||
@@ -63,9 +64,12 @@ if($account->isLoaded()) {
|
||||
'statusMsg' => $statusMsg,
|
||||
'newPassword' => $newPassword,
|
||||
]);
|
||||
} else {
|
||||
$error = Validator::getLastError();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$error = Validator::getLastError();
|
||||
$error = 'Passwords are not the same!';
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -9,7 +9,7 @@ if($account->isLoaded()) {
|
||||
$account_key = $account->getCustomField('key');
|
||||
|
||||
if(!empty($account_key)) {
|
||||
$twig->display('account/lost/recovery-key.html.twig', [
|
||||
$twig->display('account/lost/recovery-key.step-1.html.twig', [
|
||||
'nick' => $nick,
|
||||
]);
|
||||
}
|
||||
|
@@ -7,7 +7,8 @@ $title = 'Lost Account';
|
||||
|
||||
$key = trim($_REQUEST['key']);
|
||||
$nick = stripslashes($_REQUEST['nick']);
|
||||
$newPassword = trim($_REQUEST['passor']);
|
||||
$newPassword = trim($_REQUEST['password']);
|
||||
$passwordRepeat = trim($_REQUEST['password_repeat']);
|
||||
$newEmail = trim($_REQUEST['email']);
|
||||
|
||||
$player = new OTS_Player();
|
||||
@@ -23,12 +24,12 @@ if($account->isLoaded()) {
|
||||
if(!empty($accountKey)) {
|
||||
if($accountKey == $key) {
|
||||
if(Validator::password($newPassword)) {
|
||||
if(Validator::email($newEmail)) {
|
||||
if ($newPassword == $passwordRepeat) {
|
||||
if (Validator::email($newEmail)) {
|
||||
$account->setEMail($newEmail);
|
||||
|
||||
$tmp_new_pass = $newPassword;
|
||||
if(USE_ACCOUNT_SALT)
|
||||
{
|
||||
if (USE_ACCOUNT_SALT) {
|
||||
$salt = generateRandomString(10, false, true, true);
|
||||
$tmp_new_pass = $salt . $newPassword;
|
||||
}
|
||||
@@ -36,26 +37,24 @@ if($account->isLoaded()) {
|
||||
$account->setPassword(encrypt($tmp_new_pass));
|
||||
$account->save();
|
||||
|
||||
if(USE_ACCOUNT_SALT) {
|
||||
if (USE_ACCOUNT_SALT) {
|
||||
$account->setCustomField('salt', $salt);
|
||||
}
|
||||
|
||||
$statusMsg = '';
|
||||
if($account->getCustomField('email_next') < time()) {
|
||||
if ($account->getCustomField('email_next') < time()) {
|
||||
$mailBody = $twig->render('mail.account.lost.new-email.html.twig', [
|
||||
'account' => $account,
|
||||
'newPassword' => $newPassword,
|
||||
'newEmail' => $newEmail,
|
||||
]);
|
||||
|
||||
if(_mail($account->getCustomField('email'), configLua('serverName') . ' - New password to your account', $mailBody)) {
|
||||
if (_mail($account->getCustomField('email'), configLua('serverName') . ' - New password to your account', $mailBody)) {
|
||||
$statusMsg = '<br /><small>Sent e-mail with your account name and password to new e-mail. You should receive this e-mail in 15 minutes. You can login now with new password!</small>';
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$statusMsg = '<br /><p class="error">An error occurred while sending email! You will not receive e-mail with this informations. For Admin: More info can be found in system/logs/mailer-error.log</p>';
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$statusMsg = '<br /><small>You will not receive e-mail with this informations.</small>';
|
||||
}
|
||||
|
||||
@@ -65,9 +64,12 @@ if($account->isLoaded()) {
|
||||
'newPassword' => $newPassword,
|
||||
'newEmail' => $newEmail,
|
||||
]);
|
||||
} else {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
}
|
||||
else {
|
||||
$errors[] = Validator::getLastError();
|
||||
$errors[] = 'Passwords are not the same!';
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -5,22 +5,40 @@ Please enter new password to your account and repeat to make sure you remember p
|
||||
|
||||
<input type="hidden" name="character" value="{{ character }}">
|
||||
<input type="hidden" name="code" value="{{ code }}">
|
||||
|
||||
<table class="myaac-table" style="width: 100%;">
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="white"><B>Passwords</B></th>
|
||||
<th class="white"><b>Passwords</b></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
New password: <input type="password" ID="passor" name="passor" value="" size="40"><br/>
|
||||
Repeat new password: <input TYPE="password" ID="passor2" name="passor2" value="" size="40"><br/>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="password">New password:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" id="password" name="password" value="" size="40">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="password_repeat">Repeat new password:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" id="password_repeat" name="password_repeat" value="" size="40">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
<br/>
|
||||
<table style="width: 100%">
|
||||
|
@@ -12,9 +12,34 @@ Your account name, new password and new e-mail.<br/>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
Account name: <b>{{ account.getName() }}</b><br/>
|
||||
New password: <b>{{ newPassword }}</b><br/>
|
||||
New e-mail address: <b>{{ newEmail }}</b><br/>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
Account name:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ account.getName() }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
New password:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ newPassword }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
New e-mail address:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ newEmail }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{{ statusMsg|raw }}
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -16,8 +16,24 @@ If you enter right recovery key you will see form to set new e-mail and password
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
Character name: <input type=text name="nick" value="{{ nick }}" size="40" readonly="readonly"><br/>
|
||||
Recovery key: <input type="text" name="key" value="" size="40"><br/>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="nick">Character name:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type=text id="nick" name="nick" value="{{ nick }}" size="40" readonly="readonly">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="key">Recovery key:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="key" name="key" value="" size="40">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
@@ -31,26 +31,26 @@ Set new password and e-mail to your account.<br>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="nick">New password:</label>
|
||||
<label for="password">New password:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="passor" type="password" name="passor" value="" size="40">
|
||||
<input type="password" id="password" name="password" value="" size="40">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="nick">Repeat new password:</label>
|
||||
<label for="password_repeat">Repeat new password:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="passor2" type="password" name="passor" value="" size="40">
|
||||
<input type="password" id="password_repeat" name="password_repeat" value="" size="40">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="nick">New e-mail address:</label>
|
||||
<label for="email">New e-mail address:</label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="email" type="text" name="email" value="" size="40">
|
||||
<input type="text" id="email" name="email" value="" size="40">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@@ -2,6 +2,6 @@
|
||||
<p>Changed password and e-mail to your account in Lost Account Interface on server <a href="{{ constant('BASE_URL') }}"><b>{{ config('lua')['serverName'] }}</b></a></p>
|
||||
<p>Account name: <b>{{ account.getName() }}</b></p>
|
||||
<p>New password: <b>{{ newPassword }}</b></p>
|
||||
<p>E-mail: <b>{{ $newEmail }}</b> (this e-mail)</p>
|
||||
<p>E-mail: <b>{{ newEmail }}</b> (this e-mail)</p>
|
||||
<br/>
|
||||
<p><u>It's automatic e-mail from OTS Lost Account System. Do not reply!</u></p>
|
||||
|
Reference in New Issue
Block a user