You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/UserCenter/Views/Account/ForgotPassword.cshtml

47 lines
1.6 KiB

@model ResetPasswordModel
@{
Layout = "/Views/Shared/_Layout.cshtml";
DisableBackUrl = true;
HtmlTitle = ViewContext.ViewData.ModelMetadata.ModelType.GetDisplayName();
}
@Html.EditorForModel()
@inject IConfiguration _cfg
@{
var total = _cfg.GetValue<int>("CaptchaSeconds");
var sec = total;
var session = this.Context.Session;
var model = session.Get<CodeCaptchaModel>(CodeCaptchaModel.Key);
if (model != null)
{
sec = (int)(model.ExpireDateUtc - DateTime.UtcNow).TotalSeconds;
}
var url = Url.Action("SendCodeToEmail");
}
@section scripts{
<script>
$(function () {
$('#UserName').rules().remote.complete = function (xhr) {
if (xhr.status == 200 && xhr.responseText === 'true') {
var data = $.parseJSON(xhr.getResponseHeader('x-model'));
$('#Type').find('option').not('[value=""]').remove();
$.each(data, function (i, v) {
$('#Type').append('<option value="' + v.Value + '">' + v.Text + '</option>');
});
$('#Type').parents('form').validate().element('#Type');
}
};
$('#Type').change(function () {
var value = $(this).find(':selected').val();
$('#CodeCaptcha').attr('data-url', value);
$('#Type').parents('form').validate().element('#Type');
});
});
function valid() {
return true;
}
function getUrl() {
return $('#CodeCaptcha').attr('data-url');
}
</script>
@await Html.PartialAsync("_Script")
}