Exemplo n.º 1
0
        public string Register(SignupRequest signup)
        {
            var user = RepoUsers.GetUserByUserNameOrEmail(signup.UserName, signup.Email);

            if (user != null) throw new UserAlreadyExistsException();

            string hash, salt;
            Auth.GetHashAndSaltString(signup.Password, out hash, out salt);

            user = IoC.Resolve<IUserRecord>();
            user.Email = signup.Email;
            user.UserName = signup.UserName;
            user.PasswordHash = hash;
            user.Salt = salt;

            var userId = RepoUsers.CreateUser(user);

            Auth.GetHashAndSaltString(userId, out hash, out salt);

            var key = RepoUsers.CreateActivation(userId, signup.Email, hash, salt);

            Mailer.Dispatch(new ActivationMail {ActivationKey = key, User = user});

            return key;
        }
Exemplo n.º 2
0
 public object Any(SignupRequest request)
 {
     var key = Process.Register(request);
     return key;
 }