public ValidApplicationReceived()
 {
     _registrator = new Registrator();
     var app = new Application(email:"*****@*****.**",password:"******",confirm:"password");
     _result = _registrator.ApplyForMembership(app);
     _user = _result.NewUser;
 }
        public PasswordDontMatch()
        {
            var app = new Application("*****@*****.**", "password", "password");
              new Registrator().ApplyForMembership(app);

              _result = new Authenticator().AuthenticateUser(new Credentials { Email = "*****@*****.**", Password = "******" });
        }
Exemple #3
0
        public ValidEmail()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var result = new Registrator().ApplyForMembership(app);

              _result = new MonkeyFist.Services.Reminders().SendReminderTokenToUser("*****@*****.**");
        }
        public LoggingOut()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var regResult = new Registrator().ApplyForMembership(app);

              _loggedOut = new Authenticator().EndUserSession(regResult.SessionToken);
        }
        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 ValidTokenLogin()
        {
            //register the new user...
              var app = new Application("*****@*****.**", "password", "password");
              var result = new Registrator().ApplyForMembership(app);

              var auth = new Authenticator();
              _result = auth.AuthenticateUserByToken(result.NewUser.AuthenticationToken.ToString());
        }
Exemple #9
0
        public ValidLogin()
        {
            //register the new user...
              var app = new Application("*****@*****.**", "password", "password");
              new Registrator().ApplyForMembership(app);

              var auth = new Authenticator();
              _result = auth.AuthenticateUser(new Credentials { Email = "*****@*****.**", Password = "******" });
        }
        public TokenResponseExpired()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var regResult = new Registrator().ApplyForMembership(app);

              using (var session = new Session()) {
            var user = session.Users.FirstOrDefault(x => x.Email == regResult.NewUser.Email);
            user.ReminderSentAt = DateTime.Now.AddDays(-1);
            session.SaveChanges();
              }

              result = new MonkeyFist.Services.Reminders().ResetUserPassword(regResult.NewUser.ReminderToken, "newPassword");
        }
Exemple #11
0
 public RegistrationResult Register(string email, string password, string confirm, string ipAddress = "127.0.0.1")
 {
     var app = new Application(email, password, confirm);
       return _reg.ApplyForMembership(app);
 }
 public ShortPassword()
 {
     var app = new Application("*****@*****.**", "pass", "pass");
       _result = new Registrator().ApplyForMembership(app);
 }
 public ShortEmail()
 {
     var app = new Application("rob@b", "password", "password");
       _result = new Registrator().ApplyForMembership(app);
 }
Exemple #14
0
        public RegistrationResult ApplyForMembership(Application app)
        {
            var result = new RegistrationResult();

              CurrentApplication = app;
              result.Application = app;
              result.Application.UserMessage = "Welcome!";

              if (EmailOrPasswordNotPresent())
            return InvalidApplication(Properties.Resources.EmailOrPasswordMissing);

              if (EmailIsInvalid())
            return InvalidApplication(Properties.Resources.InvalidEmailMessage);

              if (PasswordIsInvalid())
            return InvalidApplication(Properties.Resources.InvalidPassword);

              if (PasswordDoesNotMatchConfirmation())
            return InvalidApplication(Properties.Resources.PasswordConfirmationMismatch);

              if (EmailAlreadyRegistered())
            return InvalidApplication(Properties.Resources.EmailExists);

              //Accept the application
              result.NewUser = AcceptApplication();

              //log them in
              var auth = new Authenticator().AuthenticateUser(new Credentials { Email = result.NewUser.Email, Password = CurrentApplication.Password });
              result.SessionToken = auth.Session.ID;

              return result;
        }
 public PasswordMistmatch()
 {
     var app = new Application("*****@*****.**", "password", "something else");
       _result = new Registrator().ApplyForMembership(app);
 }
 public void ApplicationReturnsMessage()
 {
     var app2 = new Application("*****@*****.**", "password", "password");
       _result = new Registrator().ApplyForMembership(app2);
       Assert.Contains("exists", _result.Application.UserMessage);
 }
 public void ApplicationIsInvalid()
 {
     var app2 = new Application("*****@*****.**", "password", "password");
       _result = new Registrator().ApplyForMembership(app2);
       Assert.True(app2.IsInvalid());
 }
 public void AppDoesntThrow()
 {
     var app2 = new Application("*****@*****.**", "password", "password");
       Assert.DoesNotThrow(() => _result = new Registrator().ApplyForMembership(app2));
 }
 public ExistingEmail()
     : base()
 {
     var app1 = new Application("*****@*****.**", "password", "password");
       _result = new Registrator().ApplyForMembership(app1);
 }