mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Template/Update (Part 46 - III)
* account management rework: Recovery Options
This commit is contained in:
101
endpoints/account/forgot-password.php
Normal file
101
endpoints/account/forgot-password.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
/*
|
||||
* accessed via links on signin form and from recovery email
|
||||
*
|
||||
* A) redirect to external page
|
||||
* B) 1. click password reset link > display email form
|
||||
* 2. submit email form > send mail with recovery link
|
||||
* 3. click recovery link from mail > display password reset form
|
||||
* 4. submit password reset form > update password
|
||||
*/
|
||||
|
||||
class AccountforgotpasswordResponse extends TemplateResponse
|
||||
{
|
||||
use TrRecoveryHelper, TrGetNext;
|
||||
|
||||
protected string $template = 'text-page-generic';
|
||||
protected string $pageName = 'forgot-password';
|
||||
|
||||
protected array $expectedPOST = array(
|
||||
'email' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_FLAG_STRIP_AOWOW]
|
||||
);
|
||||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
{
|
||||
// don't redirect logged in users
|
||||
// you can be forgetful AND logged in
|
||||
|
||||
if (Cfg::get('ACC_EXT_RECOVER_URL'))
|
||||
$this->forward(Cfg::get('ACC_EXT_RECOVER_URL'));
|
||||
|
||||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
{
|
||||
$this->title[] = Lang::account('title');
|
||||
|
||||
parent::generate();
|
||||
|
||||
$msg = $this->processMailForm();
|
||||
|
||||
if ($this->success)
|
||||
$this->inputbox = ['inputbox-status', ['head' => Lang::account('inputbox', 'head', 'recoverPass', [1.5]), 'message' => $msg]];
|
||||
else
|
||||
$this->inputbox = ['inputbox-form-email', array(
|
||||
'head' => Lang::account('inputbox', 'head', 'recoverPass', [1]),
|
||||
'error' => $msg,
|
||||
'action' => '?account=forgot-password&next='.$this->getNext(),
|
||||
'email' => $this->_post['email'] ?? ''
|
||||
)];
|
||||
}
|
||||
|
||||
private function processMailForm() : string
|
||||
{
|
||||
// no input yet. show clean email form
|
||||
if (is_null($this->_post['email']))
|
||||
return '';
|
||||
|
||||
// truncated due to validation fail
|
||||
if (!$this->_post['email'])
|
||||
return Lang::account('emailInvalid');
|
||||
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ?_account_bannedips WHERE `ip` = ? AND `type` = ?d AND `count` > ?d AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_PASSWORD_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
|
||||
// on cooldown pretend we dont know the email address
|
||||
if ($timeout && $timeout > time())
|
||||
return Cfg::get('DEBUG') ? 'resend on cooldown: '.Util::formatTimeDiff($timeout).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
|
||||
|
||||
// pretend recovery started
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `email` = ?', $this->_post['email']))
|
||||
{
|
||||
// do not confirm or deny existence of email
|
||||
$this->success = !Cfg::get('DEBUG');
|
||||
return Cfg::get('DEBUG') ? Lang::account('inputbox', 'error', 'emailNotFound') : Lang::account('inputbox', 'message', 'recovPassSent', [$this->_post['email']]);
|
||||
}
|
||||
|
||||
// recovery actually started
|
||||
if ($err = $this->startRecovery(ACC_STATUS_RECOVER_PASS, 'reset-password', $this->_post['email']))
|
||||
return $err;
|
||||
|
||||
DB::Aowow()->query('INSERT INTO ?_account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (?, ?d, ?d, UNIX_TIMESTAMP() + ?d) ON DUPLICATE KEY UPDATE `count` = `count` + ?d, `unbanDate` = UNIX_TIMESTAMP() + ?d',
|
||||
User::$ip, IP_BAN_TYPE_PASSWORD_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT') + 1, Cfg::get('ACC_FAILED_AUTH_COUNT'), Cfg::get('ACC_FAILED_AUTH_BLOCK'), Cfg::get('ACC_FAILED_AUTH_BLOCK'));
|
||||
|
||||
$this->success = true;
|
||||
return Lang::account('inputbox', 'message', 'recovPassSent', [$this->_post['email']]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
100
endpoints/account/forgot-username.php
Normal file
100
endpoints/account/forgot-username.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
/*
|
||||
* accessed via link on signin form
|
||||
*
|
||||
* A) redirect to external page
|
||||
* B) 1. click password reset link > display email form
|
||||
* 2. submit email form > send mail with recovery link
|
||||
* ( 3. click recovery link from mail to go to signin page (so not on this page) )
|
||||
*/
|
||||
|
||||
class AccountforgotusernameResponse extends TemplateResponse
|
||||
{
|
||||
use TrRecoveryHelper;
|
||||
|
||||
protected string $template = 'text-page-generic';
|
||||
protected string $pageName = 'forgot-username';
|
||||
|
||||
protected array $expectedPOST = array(
|
||||
'email' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_FLAG_STRIP_AOWOW]
|
||||
);
|
||||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
{
|
||||
// if the user is looged in goto account dashboard
|
||||
if (User::isLoggedIn())
|
||||
$this->forward('?account');
|
||||
|
||||
if (Cfg::get('ACC_EXT_RECOVER_URL'))
|
||||
$this->forward(Cfg::get('ACC_EXT_RECOVER_URL'));
|
||||
|
||||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
{
|
||||
$this->title[] = Lang::account('title');
|
||||
|
||||
parent::generate();
|
||||
|
||||
$msg = $this->processMailForm();
|
||||
|
||||
if ($this->success)
|
||||
$this->inputbox = ['inputbox-status', ['head' => Lang::account('inputbox', 'head', 'recoverUser'), 'message' => $msg]];
|
||||
else
|
||||
$this->inputbox = ['inputbox-form-email', array(
|
||||
'head' => Lang::account('inputbox', 'head', 'recoverUser'),
|
||||
'error' => $msg,
|
||||
'action' => '?account=forgot-username'
|
||||
)];
|
||||
}
|
||||
|
||||
private function processMailForm() : string
|
||||
{
|
||||
// no input yet. show empty form
|
||||
if (is_null($this->_post['email']))
|
||||
return '';
|
||||
|
||||
// truncated due to validation fail
|
||||
if (!$this->_post['email'])
|
||||
return Lang::account('emailInvalid');
|
||||
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ?_account_bannedips WHERE `ip` = ? AND `type` = ?d AND `count` > ?d AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_USERNAME_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
|
||||
// on cooldown pretend we dont know the email address
|
||||
if ($timeout && $timeout > time())
|
||||
return Cfg::get('DEBUG') ? 'resend on cooldown: '.Util::formatTimeDiff($timeout).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
|
||||
|
||||
// pretend recovery started
|
||||
if (!DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `email` = ?', $this->_post['email']))
|
||||
{
|
||||
// do not confirm or deny existence of email
|
||||
$this->success = !Cfg::get('DEBUG');
|
||||
return Cfg::get('DEBUG') ? Lang::account('inputbox', 'error', 'emailNotFound') : Lang::account('inputbox', 'message', 'recovUserSent', [$this->_post['email']]);
|
||||
}
|
||||
|
||||
// recovery actually started
|
||||
if ($err = $this->startRecovery(ACC_STATUS_RECOVER_USER, 'recover-user', $this->_post['email']))
|
||||
return $err;
|
||||
|
||||
DB::Aowow()->query('INSERT INTO ?_account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (?, ?d, ?d, UNIX_TIMESTAMP() + ?d) ON DUPLICATE KEY UPDATE `count` = `count` + ?d, `unbanDate` = UNIX_TIMESTAMP() + ?d',
|
||||
User::$ip, IP_BAN_TYPE_USERNAME_RECOVERY, Cfg::get('ACC_FAILED_AUTH_COUNT') + 1, Cfg::get('ACC_FAILED_AUTH_COUNT'), Cfg::get('ACC_FAILED_AUTH_BLOCK'), Cfg::get('ACC_FAILED_AUTH_BLOCK'));
|
||||
|
||||
$this->success = true;
|
||||
return Lang::account('inputbox', 'message', 'recovUserSent', [$this->_post['email']]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
52
endpoints/account/resend-submit.php
Normal file
52
endpoints/account/resend-submit.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
/*
|
||||
* accessed after successful resend request
|
||||
* empty page with status box
|
||||
*/
|
||||
|
||||
class AccountResendsubmitResponse extends TemplateResponse
|
||||
{
|
||||
protected string $template = 'text-page-generic';
|
||||
protected string $pageName = 'resend';
|
||||
|
||||
protected array $expectedPOST = array(
|
||||
'email' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_FLAG_STRIP_AOWOW]
|
||||
);
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
{
|
||||
if (!Cfg::get('ACC_ALLOW_REGISTER') || Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
{
|
||||
$this->title[] = Lang::account('title');
|
||||
|
||||
$error = $message = '';
|
||||
|
||||
if ($this->assertPOST('email'))
|
||||
$message = Lang::account('inputbox', 'message', 'createAccSent', [$this->_post['email']]);
|
||||
else
|
||||
$error = Lang::main('intError');
|
||||
|
||||
parent::generate();
|
||||
|
||||
$this->inputbox = ['inputbox-status', array(
|
||||
'head' => Lang::account('inputbox', 'head', 'register', [1.5]),
|
||||
'message' => $message,
|
||||
'error' => $error
|
||||
)];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
98
endpoints/account/resend.php
Normal file
98
endpoints/account/resend.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
/*
|
||||
* accessed via link on login page
|
||||
* empty page with status box
|
||||
*/
|
||||
|
||||
class AccountResendResponse extends TemplateResponse
|
||||
{
|
||||
protected string $template = 'text-page-generic';
|
||||
protected string $pageName = 'resend';
|
||||
|
||||
protected array $expectedPOST = array(
|
||||
'email' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_FLAG_STRIP_AOWOW]
|
||||
);
|
||||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct(string $pageParam)
|
||||
{
|
||||
if (Cfg::get('ACC_EXT_RECOVER_URL'))
|
||||
$this->forward(Cfg::get('ACC_EXT_RECOVER_URL'));
|
||||
|
||||
if (!Cfg::get('ACC_ALLOW_REGISTER') || Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
|
||||
parent::__construct($pageParam);
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
{
|
||||
$this->title[] = Lang::account('title');
|
||||
|
||||
parent::generate();
|
||||
|
||||
// error from account=activate
|
||||
if (isset($_SESSION['error']['activate']))
|
||||
{
|
||||
$msg = $_SESSION['error']['activate'];
|
||||
unset($_SESSION['error']['activate']);
|
||||
}
|
||||
else
|
||||
$msg = $this->resend();
|
||||
|
||||
if ($this->success)
|
||||
$this->inputbox = ['inputbox-status', ['head' => Lang::account('inputbox', 'head', 'resendMail'), 'message' => $msg]];
|
||||
else
|
||||
$this->inputbox = ['inputbox-form-email', array(
|
||||
'head' => Lang::account('inputbox', 'head', 'resendMail'),
|
||||
'message' => Lang::account('inputbox', 'message', 'resendMail'),
|
||||
'error' => $msg,
|
||||
'action' => '?account=resend',
|
||||
)];
|
||||
}
|
||||
|
||||
private function resend() : string
|
||||
{
|
||||
// no input yet. show clean form
|
||||
if (is_null($this->_post['email']))
|
||||
return '';
|
||||
|
||||
// truncated due to validation fail
|
||||
if (!$this->_post['email'])
|
||||
return Lang::account('emailInvalid');
|
||||
|
||||
$timeout = DB::Aowow()->selectCell('SELECT `unbanDate` FROM ?_account_bannedips WHERE `ip` = ? AND `type` = ?d AND `count` > ?d AND `unbanDate` > UNIX_TIMESTAMP()', User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT, Cfg::get('ACC_FAILED_AUTH_COUNT'));
|
||||
|
||||
// on cooldown pretend we dont know the email address
|
||||
if ($timeout && $timeout > time())
|
||||
return Cfg::get('DEBUG') ? 'resend on cooldown: '.Util::formatTimeDiff($timeout).' remaining' : Lang::account('inputbox', 'error', 'emailNotFound');
|
||||
|
||||
// check email and account status
|
||||
if ($token = DB::Aowow()->selectCell('SELECT `token` FROM ?_account WHERE `email` = ? AND `status` = ?d', $this->_post['email'], ACC_STATUS_NEW))
|
||||
{
|
||||
if (!Util::sendMail($this->_post['email'], 'activate-account', [$token]))
|
||||
return Lang::main('intError');
|
||||
|
||||
DB::Aowow()->query('INSERT INTO ?_account_bannedips (`ip`, `type`, `count`, `unbanDate`) VALUES (?, ?d, ?d, UNIX_TIMESTAMP() + ?d) ON DUPLICATE KEY UPDATE `count` = `count` + ?d, `unbanDate` = UNIX_TIMESTAMP() + ?d',
|
||||
User::$ip, IP_BAN_TYPE_REGISTRATION_ATTEMPT, Cfg::get('ACC_FAILED_AUTH_COUNT') + 1, Cfg::get('ACC_FAILED_AUTH_COUNT'), Cfg::get('ACC_FAILED_AUTH_BLOCK'), Cfg::get('ACC_FAILED_AUTH_BLOCK'));
|
||||
|
||||
$this->success = true;
|
||||
return Lang::account('inputbox', 'message', 'createAccSent', [$this->_post['email']]);
|
||||
}
|
||||
|
||||
// pretend recovery started
|
||||
// do not confirm or deny existence of email
|
||||
$this->success = !Cfg::get('DEBUG');
|
||||
return Cfg::get('DEBUG') ? Lang::account('inputbox', 'error', 'emailNotFound') : Lang::account('inputbox', 'message', 'createAccSent', [$this->_post['email']]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
121
endpoints/account/reset-password.php
Normal file
121
endpoints/account/reset-password.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace Aowow;
|
||||
|
||||
if (!defined('AOWOW_REVISION'))
|
||||
die('illegal access');
|
||||
|
||||
|
||||
/*
|
||||
* accessed via links on signin form and from recovery email
|
||||
*
|
||||
* A) redirect to external page
|
||||
* B) 1. click password reset link > display email form
|
||||
* 2. submit email form > send mail with recovery link
|
||||
* 3. click recovery link from mail > display password reset form
|
||||
* 4. submit password reset form > update password
|
||||
*/
|
||||
|
||||
class AccountresetpasswordResponse extends TemplateResponse
|
||||
{
|
||||
use TrRecoveryHelper, TrGetNext;
|
||||
|
||||
protected string $template = 'text-page-generic';
|
||||
protected string $pageName = 'reset-password';
|
||||
|
||||
protected array $expectedGET = array(
|
||||
'key' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-zA-Z0-9]{40}$/']],
|
||||
'next' => ['filter' => FILTER_SANITIZE_URL, 'flags' => FILTER_FLAG_STRIP_AOWOW ]
|
||||
);
|
||||
protected array $expectedPOST = array(
|
||||
'key' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => '/^[a-zA-Z0-9]{40}$/']],
|
||||
'email' => ['filter' => FILTER_VALIDATE_EMAIL, 'flags' => FILTER_FLAG_STRIP_AOWOW ],
|
||||
'password' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkTextLine'] ],
|
||||
'c_password' => ['filter' => FILTER_CALLBACK, 'options' => [self::class, 'checkTextLine'] ]
|
||||
);
|
||||
|
||||
private bool $success = false;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->title[] = Lang::account('title');
|
||||
|
||||
parent::__construct();
|
||||
|
||||
// don't redirect logged in users
|
||||
// you can be forgetful AND logged in
|
||||
|
||||
if (Cfg::get('ACC_EXT_RECOVER_URL'))
|
||||
$this->forward(Cfg::get('ACC_EXT_RECOVER_URL'));
|
||||
|
||||
if (Cfg::get('ACC_AUTH_MODE') != AUTH_MODE_SELF)
|
||||
$this->generateError();
|
||||
}
|
||||
|
||||
protected function generate() : void
|
||||
{
|
||||
parent::generate();
|
||||
|
||||
$errMsg = '';
|
||||
if (!$this->assertGET('key') && !$this->assertPOST('key'))
|
||||
$errMsg = Lang::account('inputbox', 'error', 'passTokenLost');
|
||||
else if ($this->_get['key'] && !DB::Aowow()->selectCell('SELECT 1 FROM ?_account WHERE `token` = ? AND `status` = ?d AND `statusTimer` > UNIX_TIMESTAMP()', $this->_get['key'], ACC_STATUS_RECOVER_PASS))
|
||||
$errMsg = Lang::account('inputbox', 'error', 'passTokenUsed');
|
||||
|
||||
if ($errMsg)
|
||||
{
|
||||
$this->inputbox = ['inputbox-status', array(
|
||||
'head' => Lang::account('inputbox', 'head', 'error'),
|
||||
'error' => $errMsg
|
||||
)];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// step "2.5"
|
||||
$errMsg = $this->doResetPass();
|
||||
if ($this->success)
|
||||
$this->forward('?account=signin');
|
||||
|
||||
// step 2
|
||||
$this->inputbox = ['inputbox-form-password', array(
|
||||
'head' => Lang::account('inputbox', 'head', 'recoverPass', [2]),
|
||||
'token' => $this->_post['key'] ?? $this->_get['key'],
|
||||
'action' => '?account=reset-password&next=account=signin',
|
||||
'error' => $errMsg,
|
||||
)];
|
||||
}
|
||||
|
||||
private function doResetPass() : string
|
||||
{
|
||||
// no input yet. show clean form
|
||||
if (!$this->assertPOST('key', 'password', 'c_password') && is_null($this->_post['email']))
|
||||
return '';
|
||||
|
||||
// truncated due to validation fail
|
||||
if (!$this->_post['email'])
|
||||
return Lang::account('emailInvalid');
|
||||
|
||||
if ($this->_post['password'] != $this->_post['c_password'])
|
||||
return Lang::account('passCheckFail');
|
||||
|
||||
$userData = DB::Aowow()->selectRow('SELECT `id`, `passHash` FROM ?_account WHERE `token` = ? AND `email` = ? AND `status` = ?d AND `statusTimer` > UNIX_TIMESTAMP()',
|
||||
$this->_post['key'],
|
||||
$this->_post['email'],
|
||||
ACC_STATUS_RECOVER_PASS
|
||||
);
|
||||
if (!$userData)
|
||||
return Lang::account('inputbox', 'error', 'emailNotFound');
|
||||
|
||||
if (!User::verifyCrypt($this->_post['c_password'], $userData['passHash']))
|
||||
return Lang::account('newPassDiff');
|
||||
|
||||
if (!DB::Aowow()->query('UPDATE ?_account SET `passHash` = ?, `status` = ?d WHERE `id` = ?d', User::hashCrypt($this->_post['c_password']), ACC_STATUS_NONE, $userData['id']))
|
||||
return Lang::main('intError');
|
||||
|
||||
$this->success = true;
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
46
template/bricks/inputbox-form-email.tpl.php
Normal file
46
template/bricks/inputbox-form-email.tpl.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace Aowow\Template;
|
||||
|
||||
use \Aowow\Lang;
|
||||
?>
|
||||
<div class="pad3"></div>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function inputBoxValidate(f)
|
||||
{
|
||||
var e = $('input[name=email]', f);
|
||||
if (e.val().length == 0)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_enteremail;
|
||||
e.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!g_isEmailValid(e.val()))
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_emailnotvalid;
|
||||
e.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<form action="<?=$action ?? '.'; ?>" method="post" onsubmit="return inputBoxValidate(this)">
|
||||
<div class="inputbox">
|
||||
<h1><?=$head ?? ''; ?></h1>
|
||||
<div id="inputbox-error"><?=$error ?? ''; ?></div>
|
||||
<?php if ($message ?? ''): ?>
|
||||
<?=$message; ?>
|
||||
<div class="pad2"></div>
|
||||
<?php endif; ?>
|
||||
<div style="text-align: center">
|
||||
<?=Lang::account('email').Lang::main('colon'); ?><input type="text" name="email" value="" id="email-generic" style="width: 12em" />
|
||||
<div class="pad2"></div>
|
||||
|
||||
<input type="submit" value="<?=Lang::account('continue'); ?>" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">$WH.ge('email-generic').focus()</script>
|
||||
78
template/bricks/inputbox-form-password.tpl.php
Normal file
78
template/bricks/inputbox-form-password.tpl.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
namespace Aowow\Template;
|
||||
|
||||
use \Aowow\Lang;
|
||||
?>
|
||||
<div class="pad3"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function inputBoxValidate(f)
|
||||
{
|
||||
var _ = f.elements[0];
|
||||
if (_.value.length == 0)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_enternewpass;
|
||||
_.focus();
|
||||
return false;
|
||||
}
|
||||
else if (_.value.length < 4)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_passwordmin;
|
||||
_.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
_ = f.elements[1];
|
||||
if (_.value.length == 0 || f.elements[2].value != _.value)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_passwordsdonotmatch;
|
||||
_.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var e = $('input[name=email]', f)
|
||||
if (e.val().length == 0)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_enteremail;
|
||||
e.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!g_isEmailValid(e.val()))
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_emailnotvalid;
|
||||
e.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<form action="<?=$action ?? '.'; ?>" method="post" onsubmit="return inputBoxValidate(this)">
|
||||
<div class="inputbox" style="position: relative">
|
||||
<h1><?=$head ?? ''; ?></h1>
|
||||
<div id="inputbox-error"><?=$error ?? ''; ?></div>
|
||||
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td align="right"><?=Lang::account('email').Lang::main('colon'); ?></td>
|
||||
<td><input type="text" name="email" style="width: 10em" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><?=Lang::account('newPass'); ?></td>
|
||||
<td><input type="password" name="password" style="width: 10em" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><?=Lang::account('passConfirm'); ?></td>
|
||||
<td><input type="password" name="c_password" style="width: 10em" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="top"></td>
|
||||
<td><input type="submit" name="signup" value="<?=Lang::account('continue'); ?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="hidden" name="key" value="<?=$token ?? ''; ?>" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">$WH.ge('username-generic').focus()</script>
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<?php if ($hasRecovery): ?>
|
||||
<br />
|
||||
<div style="position: absolute; right: 5px; bottom: 5px; white-space: nowrap;"><?=Lang::account('forgot').Lang::main('colon'); ?><a href="?account=forgotusername"><?=Lang::account('forgotUser'); ?></a> | <a href="?account=forgotpassword"><?=Lang::account('forgotPass'); ?></a> | <a href="?account=resend"><?=Lang::account('inputbox', 'head', 'resendMail'); ?></a></div>
|
||||
<div style="position: absolute; right: 5px; bottom: 5px; white-space: nowrap;"><?=Lang::account('forgot').Lang::main('colon'); ?><a href="?account=forgot-username"><?=Lang::account('forgotUser'); ?></a> | <a href="?account=forgot-password"><?=Lang::account('forgotPass'); ?></a> | <a href="?account=resend"><?=Lang::account('inputbox', 'head', 'resendMail'); ?></a></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
Password Reset
|
||||
Follow this link to reset your password.
|
||||
|
||||
HOST_URL?account=forgotpassword&key=%s
|
||||
HOST_URL?account=reset-password&key=%s
|
||||
|
||||
If you did not request this mail simply ignore it.
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
Réinitialisation du mot de passe
|
||||
Suivez ce lien pour réinitialiser votre mot de passe.
|
||||
|
||||
HOST_URL?account=forgotpassword&key=%s
|
||||
HOST_URL?account=reset-password&key=%s
|
||||
|
||||
Si vous n'avez pas fait de demande de réinitialisation, ignorez cet e-mail.
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
Kennwortreset
|
||||
Folgt diesem Link um euer Kennwort zurückzusetzen.
|
||||
|
||||
HOST_URL?account=forgotpassword&key=%s
|
||||
HOST_URL?account=reset-password&key=%s
|
||||
|
||||
Falls Ihr diese Mail nicht angefordert habt kann sie einfach ignoriert werden.
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
重置密码
|
||||
点击此链接以重置您的密码。
|
||||
|
||||
HOST_URL?account=forgotpassword&key=%s
|
||||
HOST_URL?account=reset-password&key=%s
|
||||
|
||||
如果您没有请求此邮件,请忽略它。
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
Reinicio de Contraseña
|
||||
Siga este enlace para reiniciar su contraseña.
|
||||
|
||||
HOST_URL?account=forgotpassword&key=%s
|
||||
HOST_URL?account=reset-password&key=%s
|
||||
|
||||
Si usted no solicitó este correo, por favor ignorelo.
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
Сброс пароля
|
||||
Перейдите по этой ссылке, чтобы сбросить свой пароль.
|
||||
|
||||
HOST_URL?account=forgotpassword&key=%s
|
||||
HOST_URL?account=reset-password&key=%s
|
||||
|
||||
Если вы не запрашивали это письмо, просто проигнорируйте его.
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
<?php namespace Aowow; ?>
|
||||
|
||||
<?php $this->brick('header'); ?>
|
||||
|
||||
<div class="main" id="main">
|
||||
<div class="main-precontents" id="main-precontents"></div>
|
||||
<div class="main-contents" id="main-contents">
|
||||
<?php
|
||||
$this->brick('announcement');
|
||||
|
||||
$this->brick('pageTemplate');
|
||||
?>
|
||||
<div class="pad3"></div>
|
||||
<?php if (!empty($this->text)): ?>
|
||||
<div class="inputbox">
|
||||
<h1><?=$this->head; ?></h1>
|
||||
<div id="inputbox-error"></div>
|
||||
<div style="text-align: center; font-size: 110%"><?=$this->text; ?></div>
|
||||
</div>
|
||||
<?php elseif ($this->resetPass): ?>
|
||||
<script type="text/javascript">
|
||||
function inputBoxValidate(f)
|
||||
{
|
||||
_ = f.elements[0];
|
||||
if (_.value.length == 0)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_enternewpass;
|
||||
_.focus();
|
||||
return false;
|
||||
}
|
||||
else if (_.value.length < 4)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_passwordmin;
|
||||
_.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
_ = f.elements[1];
|
||||
if (_.value.length == 0 || f.elements[1].value != _.value)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_passwordsdonotmatch;
|
||||
_.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
var e = $('input[name=email]', f)
|
||||
if (e.val().length == 0)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_enteremail;
|
||||
e.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!g_isEmailValid(e.val()))
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_emailnotvalid;
|
||||
e.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<form action="?account=signup&next=<?=$this->next . '&token=' . $this->token; ?>" method="post" onsubmit="return inputBoxValidate(this)">
|
||||
<div class="inputbox" style="position: relative">
|
||||
<h1><?=$this->head; ?></h1>
|
||||
<div id="inputbox-error"><?=$this->error; ?></div>
|
||||
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td align="right"><?=Lang::account('email').Lang::main('colon'); ?></td>
|
||||
<td><input type="text" name="email" style="width: 10em" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><?=Lang::account('newPass').Lang::main('colon'); ?></td>
|
||||
<td><input type="password" name="password" style="width: 10em" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><?=Lang::account('passConfirm').Lang::main('colon'); ?></td>
|
||||
<td><input type="password" name="c_password" style="width: 10em" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" valign="top"></td>
|
||||
<td><input type="submit" name="signup" value="<?=Lang::account('continue'); ?>" /></td>
|
||||
</tr>
|
||||
<input type="hidden" name="token" value="<?=$this->token; ?>" />
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">$WH.ge('username-generic').focus()</script>
|
||||
<?php else: ?>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function inputBoxValidate(f)
|
||||
{
|
||||
var e = $('input[name=email]', f);
|
||||
if (e.val().length == 0)
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_enteremail;
|
||||
e.focus();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!g_isEmailValid(e.val()))
|
||||
{
|
||||
$WH.ge('inputbox-error').innerHTML = LANG.message_emailnotvalid;
|
||||
e.focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<form action="?account=<?=$this->category[0]; ?>" method="post" onsubmit="return inputBoxValidate(this)">
|
||||
<div class="inputbox">
|
||||
<h1><?=$this->head; ?></h1>
|
||||
<div id="inputbox-error"><?=$this->error; ?></div>
|
||||
|
||||
<div style="text-align: center">
|
||||
<?=Lang::account('email').Lang::main('colon'); ?><input type="text" name="email" value="" id="email-generic" style="width: 12em" />
|
||||
<div class="pad2"></div>
|
||||
|
||||
<input type="submit" value="<?=Lang::account('continue'); ?>" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">$WH.ge('email-generic').focus()</script>
|
||||
<?php endif; ?>
|
||||
<div class="clear"></div>
|
||||
</div><!-- main-contents -->
|
||||
</div><!-- main -->
|
||||
|
||||
<?php $this->brick('footer'); ?>
|
||||
Reference in New Issue
Block a user