public LoggingOut()
        {
            var app = new Application("*****@*****.**", "password", "password");
              var regResult = new Registrator().ApplyForMembership(app);

              _loggedOut = new Authenticator().EndUserSession(regResult.SessionToken);
        }
예제 #2
0
        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());
        }
예제 #3
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 = "******" });
        }
예제 #4
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;
        }
예제 #5
0
 public Membership(Configuration config)
 {
     _auth = config.AuthenticationService ?? new Authenticator(config);
       _reg = config.RegistrationService ?? new Registrator(config);
       _reminders = config.ReminderService ?? new Reminders(config);
 }