Beispiel #1
0
        public async Task <IActionResult> PostAsync([FromBody] TodoUserLogin loginCreds)
        {
            var result = await _userManager.CreateAsync(new TodoUser()
            {
                UserName = loginCreds.username
            }, loginCreds.password);

            return(Ok());
        }
        public async Task <ActionResult> Authenticate([FromBody] TodoUserLogin loginCreds)
        {
            var result = await _signInManager.PasswordSignInAsync
                             (loginCreds.UserName, loginCreds.Password, true, false);

            if (result.Succeeded)
            {
                return(Ok());
            }
            else
            {
                return(Unauthorized());
            }
        }
        public async Task <ActionResult> CreateUser([FromBody] TodoUserLogin loginCreds)
        {
            var result = await _userManager.CreateAsync(new TodoUser()
            {
                UserName = loginCreds.UserName
            }, loginCreds.Password);

            if (result.Succeeded)
            {
                return(Ok());
            }
            else
            {
                return(BadRequest(result.Errors));
            }
        }
        public async Task <IActionResult> AuthenticateUserAsync([FromBody] TodoUserLogin loginCreds)
        {
            var result = await _signInManager.PasswordSignInAsync(loginCreds.username, loginCreds.password, true, false);

            return(Ok());
        }