Esempio n. 1
0
        public async Task <ActionResult> IndexAsync(ResetInfo model)
        {
            object token = Session["Token"];

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

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

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

            if (DAL.Reset.HasActiveResetRequest(model.Email))
            {
                return(Json(true));
            }

            DTO.Reset result = DAL.Reset.Request(model);

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


            ResetEmail email = new ResetEmail(result);
            await email.SendAsync();

            return(Json(true));
        }
Esempio n. 2
0
        public ActionResult Do(string token)
        {
            if (string.IsNullOrWhiteSpace(token))
            {
                return(Redirect("/site/404"));
            }

            DTO.Reset reset = DAL.Reset.GetIfActive(token);

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

            return(View(GetRazorView <AreaRegistration>("Reset/Do.cshtml")));
        }
Esempio n. 3
0
        public ActionResult Do()
        {
            string token    = Request.QueryString["token"];
            string password = Request.QueryString["password"];

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

            DTO.Reset reset = DAL.Reset.GetIfActive(token);
            if (reset != null)
            {
                DAL.Reset.CompleteReset(token, password);
                return(Json(true));
            }

            return(Json(false));
        }