public async Task <bool> ChangePasswordByEmailSecondStep(ChangePasswordSStepRequestModel model) { var player = await _context.PlayerIdentity.FirstOrDefaultAsync(t => t.Id == model.PlayerId && model.PlayerHash == t.PlayerHash); if (player == null) { return(false); } if (player.PasswordSeciurity == false) { return(false); } var passwordSb = new StringBuilder(); player.PasswordSeciurity = false; passwordSb.Append(_encrypter.Encrypted(model.Password)); var salt = await _context.PlayerSalt.FirstOrDefaultAsync(t => t.PlayerId == model.PlayerId); passwordSb.Append(salt.Salt); player.Password = passwordSb.ToString(); player.PasswordChanging = false; player.PlayerHash = player.GetHashCode().ToString(); var dbResult = _context.PlayerIdentity.Update(player); if (dbResult.State == EntityState.Modified) { await _context.SaveChangesAsync(); return(true); } return(false); }
public async Task <bool> ChangePasswordByEmailSecondStep(ChangePasswordSStepRequestModel model) { return(await _userService.ChangePasswordByEmailSecondStep(model)); }