public bool IsConfirmPasswordMatched(string password, string confirmPassword) { if (PasswordActions.PasswordsAreEqual(password, confirmPassword)) { return(true); } throw new ConfirmPasswordNotMatchException(); }
private User GetUser(User findedUser, string password) { if (findedUser == null) { throw new UserNotExistException(); } if (!PasswordActions.CheckPassword(password, findedUser)) { throw new WrongPasswordForUserException(); } return(findedUser); }
private void RegistrateUser(PreRegistrateUser user) { string salt = PasswordActions.GenerateSalt(); //create user var regUser = new User { CreateDate = DateTime.Now, Email = user.Email, Info = CorrectInfo(user.Info), IsApproved = true, Login = user.Login, PasswordHash = PasswordActions.GetHashForPassword(user.Password, salt), PasswordSalt = salt, Role = Roles.SimpleUser, UserId = Guid.NewGuid() }; using (var repo = ApplicationSettings.GetRepository()) { repo.CreateUser(regUser); repo.SaveChanges(); } }