コード例 #1
0
        //public object Any(RegisterRequest  )
        public object Post(RegisterRequest request)
        {
            string hash, salt;
            new SaltedHash().GetHashAndSaltString(request.Password, out hash, out salt);

            ResponseStatus responseStatus = null;
            Exception createUserException = null;

            try
            {
                AppHost.UserRepository.CreateUserAuth(
                    new UserAuth
                        {
                            Id = 1,
                            DisplayName = request.Email,
                            Email = request.Email,
                            UserName = request.Email,
                            PasswordHash = hash,
                            Salt = salt,
                            Roles = new List<string> {RoleNames.Admin}
                        }, request.Password
                    );
            }
            catch (Exception e)
            {
                createUserException = e;
            }

                return new RegisterResponse { Result = "true", RegisterRequest = request};
        }
コード例 #2
0
 //public object Any(RegisterRequest  )
 public object Get(RegisterRequest request)
 {
     return new RegisterResponse { Result = "true", RegisterRequest = null};
 }