コード例 #1
0
 public ValidApplicationReceived()
 {
     _registrator = new Registrator();
     var app = new Application(email:"*****@*****.**",password:"******",confirm:"password");
     _result = _registrator.ApplyForMembership(app);
     _user = _result.NewUser;
 }
コード例 #2
0
        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;
        }
コード例 #3
0
ファイル: Membership.cs プロジェクト: robconery/monkey-fist
 public User CurrentUser(string sessionToken)
 {
     if (_currentUser == null) {
     _currentUser = _auth.GetCurrentUser(Guid.Parse(sessionToken));
       }
       return _currentUser;
 }
コード例 #4
0
        public CurrentUserWithSessionToken()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var regResult = new Registrator().ApplyForMembership(app);

              _user = new Authenticator().GetCurrentUser(regResult.SessionToken);
        }
コード例 #5
0
 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;
 }
コード例 #6
0
 public ValidApplicationReceived()
     : base()
 {
     _reg = new Registrator();
       var app = new Application(email:"*****@*****.**",password:"******",confirm:"password");
       _result = _reg.ApplyForMembership(app);
       _user = _result.NewUser;
 }
コード例 #7
0
ファイル: Reminders.cs プロジェクト: robconery/monkey-fist
 public virtual string CreateReminderLink(User user)
 {
     return _config.ResetUrl + "?t=" + user.ReminderToken;
 }
コード例 #8
0
ファイル: Reminders.cs プロジェクト: robconery/monkey-fist
 public virtual bool ResetWindowIsOpen(User user)
 {
     return user.ReminderSentAt > DateTime.Now.AddHours(-12);
 }
コード例 #9
0
 public virtual void UserAuthenticated(User user)
 {
 }
コード例 #10
0
 public virtual void SetUserLoginStats(User user)
 {
     user.SignInCount += 1;
       user.CurrentSignInAt = user.LastSignInAt;
       user.LastSignInAt = DateTime.Now;
       user.IP = CurrentCredentials.IP;
 }
コード例 #11
0
 public virtual bool HashedPasswordDoesNotMatch(User user)
 {
     return !BCryptHelper.CheckPassword(CurrentCredentials.Password, user.HashedPassword);
 }
コード例 #12
0
 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;
 }