Пример #1
0
        public async Task <ActionResult> IndexAsync(ResetInfo model)
        {
            var token = this.Session["Token"];

            if (token == null)
            {
                return(this.Redirect("/"));
            }

            if (model.Token != token.ToString())
            {
                return(this.Redirect("/"));
            }

            model.Browser   = this.RemoteUser.Browser;
            model.IpAddress = this.RemoteUser.IpAddress;

            if (await ResetRequests.HasActiveResetRequestAsync(this.Tenant, model.Email).ConfigureAwait(false))
            {
                return(this.Json(true));
            }

            var result = await ResetRequests.RequestAsync(this.Tenant, model).ConfigureAwait(false);

            if (result.UserId <= 0)
            {
                return(this.Redirect("/"));
            }


            var email = new ResetEmail(result);
            await email.SendAsync(this.Tenant).ConfigureAwait(true);

            return(this.Json(true));
        }
Пример #2
0
        public async Task <ActionResult> DoAsync(string token)
        {
            if (RemoteUser.IsListedInSpamDatabase(this.Tenant))
            {
                return(this.View(this.GetRazorView <AreaRegistration>("ListedInSpamDatabase.cshtml", this.Tenant)));
            }

            if (string.IsNullOrWhiteSpace(token))
            {
                return(this.Redirect("/site/404"));
            }


            var reset = await ResetRequests.GetIfActiveAsync(this.Tenant, token).ConfigureAwait(true);

            if (reset == null)
            {
                return(this.Redirect("/site/404"));
            }

            return(this.View(this.GetRazorView <AreaRegistration>("Reset/Do.cshtml", this.Tenant)));
        }
Пример #3
0
        public async Task <ActionResult> DoAsync()
        {
            string token    = this.Request.QueryString["token"];
            string password = this.Request.QueryString["password"];

            if (string.IsNullOrWhiteSpace(token) ||
                string.IsNullOrWhiteSpace(password))
            {
                return(this.Json(false));
            }

            var reset = await ResetRequests.GetIfActiveAsync(this.Tenant, token).ConfigureAwait(true);

            if (reset != null)
            {
                await ResetRequests.CompleteResetAsync(this.Tenant, token, password).ConfigureAwait(true);

                return(this.Json(true));
            }

            return(this.Json(false));
        }