예제 #1
0
        public async Task <ActionResult <AuthenticateModel> > Register([FromBody] RegisterModel model)
        {
            var user = new User
            {
                ContactId = model.ContactId,
                Login     = model.Login,
                PassHash  = _passwordProvider.GetHash(model.Password, model.ContactId),
                Role      = model.Role
            };

            user = await _userRepository.Add(user);

            var token = _oauth.CreateToken(user);

            return(Ok(token));
        }