// var lastUpdate = Db.UserQueryByEmail(context.User.Identity.Name).Select(u => u.Timestamp).FirstOrDefault(); public ServiceResponse ValidateSecurityKey(UserResetPasswordModel model) { this.Response = new ServiceResponse(); if (model.DecryptSecurityKey() == false) { this.Response.AddError(ResourceModelUser.MU009); return(this.Response); } if (new TimeSpan(DateTime.UtcNow.Ticks - model.SecurityTicks).TotalMinutes > 30) { this.Response.AddError(ResourceModelUser.MU009); return(this.Response); } this.Response.Model = model; return(this.Response); }
public ServiceResponse ResetPassword(UserResetPasswordModel model) { this.Response = new ServiceResponse(); if (model.DecryptSecurityKey() == false) { this.Response.AddError(ResourceModelUser.MU009); return(this.Response); } Validation.IsPasswordConfirmed(this.Response.Messages, model.NewPassword, model.ConfirmPassword, "ConfirmPassword"); this.Db.ReadOnly = false; var user = this.Db.UserQueryByEmail(model.Email).FirstOrDefault(); user.Password = Crypto.Hash(model.NewPassword, user.Salt); this.Db.SaveChanges(); this.Response.Model = model; return(this.Response); }