You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
4.6 KiB
Smarty

{assign var=auth_app_name value=$config["appName"]}
{include file='auth/layout_header.tpl' auth_title='Reset Password' auth_app_name=$auth_app_name}
<main class="auth-shell">
<section class="auth-story">
<a class="auth-brand" href="/">
<img src="/theme/venix/images/logo-sm.png" alt="">
<span>{$config["appName"]}</span>
</a>
<div class="auth-story-main">
<p class="auth-kicker">Account recovery</p>
<h1>{if $language == 'true'}Recover access to your account.{else}找回账户访问权限。{/if}</h1>
<p class="auth-story-copy">{if $language == 'true'}Enter the email address you registered with. We will send a password reset link that expires for your security.{else}输入注册邮箱,我们会发送一封密码重置邮件。为了安全,链接会在有效期后自动失效。{/if}</p>
<img class="auth-illustration" src="/theme/venix/images/svg/confirmation-email.svg" alt="">
</div>
<div class="auth-highlights">
<div class="auth-highlight"><strong>{if $language == 'true'}Verify your email{else}验证邮箱{/if}</strong><span>{if $language == 'true'}The reset link is sent only to your registered email.{else}重置链接仅发送到注册邮箱。{/if}</span></div>
<div class="auth-highlight"><strong>{if $language == 'true'}Limited time{else}限时有效{/if}</strong><span>{if $language == 'true'}Request a new link if this one expires.{else}过期后需要重新申请。{/if}</span></div>
<div class="auth-highlight"><strong>{if $language == 'true'}Simple and secure{else}轻量加载{/if}</strong><span>{if $language == 'true'}Reset your password in a few steps.{else}不再加载旧页面冗余脚本。{/if}</span></div>
</div>
</section>
<section class="auth-panel-wrap">
<div class="auth-panel">
<h2 class="auth-title">{if $language == 'true'}Request a password reset{else}重置密码请求{/if}</h2>
<p class="auth-subtitle">{if $language == 'true'}If an account exists for this email, we will send a reset link.{else}填写邮箱后,如果账号存在,系统会发送重置密码邮件。{/if}</p>
<form class="auth-form" id="resetRequestForm" autocomplete="on">
<div class="auth-message" data-auth-message></div>
<div class="auth-field">
<label for="email">{if $language == 'true'}Email{else}邮箱{/if}</label>
<input id="email" name="email" type="email" autocomplete="email" required>
</div>
{if $captch_respass == 'true'}
<div class="auth-field">
<label for="captch">{if $language == 'true'}Verification code{else}图形验证码{/if}</label>
<div class="auth-row auth-row-inline">
<input id="captch" name="captch" type="text" autocomplete="off">
<img class="auth-captcha" data-captcha-img src="/api/captch?t=0" alt="captcha" title="{if $language == 'true'}Refresh captcha{else}点击刷新{/if}">
</div>
</div>
{/if}
<button type="submit" class="auth-button auth-button-block" id="reset">{if $language == 'true'}Send reset email{else}发送重置邮件{/if}</button>
</form>
</div>
</section>
</main>
{include file='auth/layout_scripts.tpl'}
<script>
var resetForm = document.getElementById('resetRequestForm');
var resetButton = document.getElementById('reset');
document.querySelectorAll('[data-captcha-img]').forEach(function (img) {
img.addEventListener('click', function () {
VenixAuth.refreshCaptcha();
});
});
function fieldValue(id) {
var field = document.getElementById(id);
return field ? field.value : '';
}
resetForm.addEventListener('submit', function (event) {
event.preventDefault();
var done = VenixAuth.setLoading(resetButton, {if $language == 'true'}'Sending...'{else}'发送中...'{/if});
VenixAuth.post('/password/reset', {
email: fieldValue('email'),
captch: fieldValue('captch')
}).then(function (data) {
VenixAuth.showMessage(resetForm, data.ret == 1 ? 'success' : 'error', data.msg);
if (data.ret != 1) {
VenixAuth.refreshCaptcha();
}
done();
}).catch(function (error) {
VenixAuth.showMessage(resetForm, 'error', error.message);
done();
});
});
</script>
</body>
</html>