public static DTO.Reset Request(ResetInfo model) { const string sql = "SELECT * FROM account.reset_account(@0::text, @1::text, @2::text);"; return Factory.Get<DTO.Reset>(AppUsers.GetCatalog(), sql, model.Email, model.Browser, model.IpAddress) .FirstOrDefault(); }
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 (DAL.Reset.HasActiveResetRequest(model.Email)) { return this.Json(true); } var result = DAL.Reset.Request(model); if (result.UserId <= 0) { return this.Redirect("/"); } var email = new ResetEmail(result); await email.SendAsync(); return this.Json(true); }
public static async Task<Reset> RequestAsync(string tenant, ResetInfo model) { string sql = FrapidDbServer.GetProcedureCommand(tenant, "account.reset_account", new[] {"@0", "@1", "@2"}); return (await Factory.GetAsync<Reset>(tenant, sql, model.Email, model.Browser, model.IpAddress).ConfigureAwait(false)) .FirstOrDefault(); }