public async Task <IActionResult> Register(RegisterModal user)
        {
            //throw new Exception("serilog");
            user.Username = user.Username.Trim().ToLower();
            user.Email    = user.Email.Trim().ToLower();

            var createdUser = await _auth.CreateUser(user, user.Password);

            return(Ok(createdUser));
        }
Example #2
0
    public static RegisterModal Instance()
    {
        if (_Instance == null)
        {
            _Instance = FindObjectOfType <RegisterModal>();

            if (_Instance == null)
            {
                Debug.LogError("there is no RegisterModal in the system");
            }
        }
        return(_Instance);
    }
Example #3
0
        public async Task <UserDto> CreateUser(RegisterModal user, string password)
        {
            byte[] passwordHash, passwordSalt;
            CreatePasswordHash(password, out passwordHash, out passwordSalt);

            var model = _mapper.Map <User>(user);

            model.PasswordHash = passwordHash;
            model.PasswordSalt = passwordSalt;
            model.RoleId       = (byte)RoleType.User;

            _uow.Users.CreateUser(model);
            await _uow.CompleteAsync();

            return(await Task.FromResult(_mapper.Map <UserDto>(model)));
        }