public bool UpdatePassword(string password)
{
string salt = GeneratePasswordSalt();
string hash = ComputePasswordHash(password, salt);
ISQLiteConnection conn = null;
try
{
conn = Injection.Kernel.Get<IDatabase>().GetSqliteConnection();
int affected = conn.Execute("UPDATE User SET PasswordHash = ?, PasswordSalt = ? WHERE UserId = ?", hash, salt, this.UserId);
if (affected > 0)
{
this.PasswordHash = hash;
this.PasswordSalt = salt;
return Injection.Kernel.Get<IUserRepository>().UpdateUserCache(this);
}
}
catch (Exception e)
{
logger.Error(e);
}
finally
{
Injection.Kernel.Get<IDatabase>().CloseSqliteConnection(conn);
}
return false;
}