public bool ChangePasswordQuestionAndAnswer(string password, string newPasswordQuestion, string newPasswordAnswer) { Password pass = PasswordsByUserId.FirstOrDefault(); bool result = false; if (pass == null) { Log.AddEntry("Unable to change password question and answer, user password was not set"); } else { string decrypted = Aes.Decrypt(pass.Value); if (decrypted.Equals(password)) { PasswordQuestion question = PasswordQuestionsByUserId.FirstOrDefault(); if (question == null) { question = PasswordQuestionsByUserId.AddNew(); } question.Value = newPasswordQuestion; question.Answer = newPasswordAnswer; question.Save(); result = true; } } return(result); }
private static PasswordQuestion CreateFromFilter(IQueryFilter filter, Database database = null) { Database db = database ?? Db.For <PasswordQuestion>(); var dao = new PasswordQuestion(); filter.Parameters.Each(p => { dao.Property(p.ColumnName, p.Value); }); dao.Save(db); return(dao); }
public ActionResult Update(Bam.Net.UserAccounts.Data.PasswordQuestion dao) { try { dao.Save(); return(Json(new { Success = true, Message = "", Dao = dao.ToJsonSafe() })); } catch (Exception ex) { return(GetErrorResult(ex)); } }