public Message(DateTime date, string text, User user) { this.Date = date; this.Text = text; this.User = user; this.HasBeenRead = false; }
string GetNewPasswordFor(User user) { var newPassword = Guid.NewGuid().ToString().Substring(0, 5); var hashedPassword = this.formsAuthenticationService.HashAndSalt(user.UserName, newPassword); user.ResetPassword(hashedPassword); return newPassword; }
void SendPasswordResetEmail(User user, string toAddress) { var isChildString = user is Child ? user.Name + "'s" : "Your"; var subject = string.Format("Tardis Bank: {0} reset password", isChildString); var body = string.Format("Here is {0} new password: {1}", isChildString, this.GetNewPasswordFor(user)); this.emailService.SendEmail(toAddress, subject, body); }
public void SaveUser(User user) { if (user == null) { throw new ArgumentNullException("user"); } this.userRepository.Save(user); }
string[] GetRoles(User user) { return user.GetRoles(); }