public void UpdatePassword(string oldPass, string newPass, string repeatedPass) { try { areNewPassAndRepeatedSame(newPass, repeatedPass); arePasswordsSame(CurrentUser.password, oldPass); isPasswordCorrect(newPass); _profileScreeenSettings.ChangePassword(Properties.Settings.Default.id, HashPassword(newPass)); CurrentUser.password = _profileScreeenSettings.GetUserFromDB(Properties.Settings.Default.id).password; this.SendMessage(CurrentUserInfo.email, "Hello " + CurrentUser.userName + "! You have changed your password successfully!"); } catch (IncorrectUserDataException) { throw; } }
//for tests public ProfileScreenSettingsService(IProfileSettingsRepository _profileSettings) { _profileScreeenSettings = _profileSettings; CurrentUser = _profileScreeenSettings.GetUserFromDB(Properties.Settings.Default.id); CurrentUserInfo = _profileScreeenSettings.GetDataForThisUser(Properties.Settings.Default.id); }