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.

84 lines
4.2 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">Set a new password</p>
<h1>{if $language == 'true'}Set a new account password.{else}设置新的账户密码。{/if}</h1>
<p class="auth-story-copy">{if $language == 'true'}Use a new password of at least 8 characters. After the reset, you will return to the login page.{else}请使用至少 8 位的新密码。提交成功后,系统会引导你回到登录页。{/if}</p>
<img class="auth-illustration" src="/theme/venix/images/svg/work-vector.svg" alt="">
</div>
<div class="auth-highlights">
<div class="auth-highlight"><strong>{if $language == 'true'}Password length{else}长度校验{/if}</strong><span>{if $language == 'true'}At least 8 characters are required.{else}后端要求密码至少 8 位。{/if}</span></div>
<div class="auth-highlight"><strong>{if $language == 'true'}Confirm twice{else}二次确认{/if}</strong><span>{if $language == 'true'}Both password entries must match.{else}两次输入必须保持一致。{/if}</span></div>
<div class="auth-highlight"><strong>{if $language == 'true'}Return to login{else}登录引导{/if}</strong><span>{if $language == 'true'}You will return to the login page after resetting.{else}重置后自动返回登录页。{/if}</span></div>
</div>
</section>
<section class="auth-panel-wrap">
<div class="auth-panel">
<h2 class="auth-title">{if $language == 'true'}Set a new password{else}设置新密码{/if}</h2>
<p class="auth-subtitle">{if $language == 'true'}Enter and confirm your new password.{else}输入并确认你的新密码。{/if}</p>
<form class="auth-form" id="resetTokenForm" autocomplete="on">
<div class="auth-message" data-auth-message></div>
<div class="auth-field">
<label for="passwd">{if $language == 'true'}New password{else}新密码{/if}</label>
<input id="passwd" name="passwd" type="password" autocomplete="new-password" required>
</div>
<div class="auth-field">
<label for="repasswd">{if $language == 'true'}Repeat new password{else}重复新密码{/if}</label>
<input id="repasswd" name="repasswd" type="password" autocomplete="new-password" required>
</div>
<button type="submit" class="auth-button auth-button-block" id="reset">{if $language == 'true'}Set new password{else}提交新密码{/if}</button>
</form>
</div>
</section>
</main>
{include file='auth/layout_scripts.tpl'}
<script>
var resetForm = document.getElementById('resetTokenForm');
var resetButton = document.getElementById('reset');
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'}'Submitting...'{else}'提交中...'{/if});
VenixAuth.post('/password/token/{$token}', {
password: fieldValue('passwd'),
repasswd: fieldValue('repasswd')
}).then(function (data) {
if (data.ret) {
VenixAuth.showMessage(resetForm, 'success', data.msg);
window.setTimeout(function () {
window.location.href = '/auth/login';
}, {$config['jump_delay']});
return;
}
VenixAuth.showMessage(resetForm, 'error', data.msg);
done();
}).catch(function (error) {
VenixAuth.showMessage(resetForm, 'error', error.message);
done();
});
});
</script>
</body>
</html>