Beispiel #1
0
        public async Task <ActionResult> Register(User user)
        {
            if (user.Email == null || user.HashedPassword == null)
            {
                return(BadRequest());
            }

            var u = await this._userService.GetUserByEmail(user.Email);

            if (u == null)
            {
                byte[] salt;

                user.HashedPassword = PasswordUtil.Encode(user.HashedPassword, out salt);
                user.Salt           = salt;

                await this._userService.Insert(user);

                return(Ok());
            }

            return(BadRequest());
        }