public ValidApplicationReceived() { _registrator = new Registrator(); var app = new Application(email:"*****@*****.**",password:"******",confirm:"password"); _result = _registrator.ApplyForMembership(app); _user = _result.NewUser; }
public UserMailerMessage SendTo(User user) { var message = new MailMessage(); message.To.Add(new MailAddress(user.Email)); message.Subject = this.Subject; message.Body = this.Body; message.IsBodyHtml = true; this.Successful = false; SmtpClient client = new SmtpClient(); try { client.Send(message); this.Successful = true; } catch (SmtpFailedRecipientException x) { this.ResultMessage = x.Message; user.Status = UserStatus.InvalidEmail; } catch (SmtpException x) { this.ResultMessage = x.Message; } //drop this into the user's mailers user.MailerLogs.Add(this); return this; }
public User CurrentUser(string sessionToken) { if (_currentUser == null) { _currentUser = _auth.GetCurrentUser(Guid.Parse(sessionToken)); } return _currentUser; }
public CurrentUserWithSessionToken() { var app = new Application("*****@*****.**", "password", "password"); var regResult = new Registrator().ApplyForMembership(app); _user = new Authenticator().GetCurrentUser(regResult.SessionToken); }
public TokenResponse() { var app = new Application("*****@*****.**", "password", "password"); var regResult = new Registrator().ApplyForMembership(app); var svc = new MonkeyFist.Services.Reminders().SendReminderTokenToUser(regResult.NewUser.Email); result = new MonkeyFist.Services.Reminders().ResetUserPassword(svc.User.ReminderToken, "newPassword"); user = result.User; }
public ValidApplicationReceived() : base() { _reg = new Registrator(); var app = new Application(email:"*****@*****.**",password:"******",confirm:"password"); _result = _reg.ApplyForMembership(app); _user = _result.NewUser; }
public virtual string CreateReminderLink(User user) { return _config.ResetUrl + "?t=" + user.ReminderToken; }
public virtual bool ResetWindowIsOpen(User user) { return user.ReminderSentAt > DateTime.Now.AddHours(-12); }
public virtual void UserAuthenticated(User user) { }
public virtual void SetUserLoginStats(User user) { user.SignInCount += 1; user.CurrentSignInAt = user.LastSignInAt; user.LastSignInAt = DateTime.Now; user.IP = CurrentCredentials.IP; }
public virtual bool HashedPasswordDoesNotMatch(User user) { return !BCryptHelper.CheckPassword(CurrentCredentials.Password, user.HashedPassword); }
public virtual UserSession CreateSession(User user) { var session = new UserSession { IP = CurrentCredentials.IP }; session.EndsAt = CurrentCredentials.RememberMe ? DateTime.Now.AddDays(30) : DateTime.Now.AddHours(6); user.Sessions.Add(session); return session; }