public object Post([FromBody] CadastrarViewModel novoLogin) { novoLogin = novoLogin ?? new CadastrarViewModel(); var usuarioLoginCriado = cadastrarApp.CadastrarUsuario(new AuthUser() { Email = novoLogin.Email, Password = novoLogin.Senha }); if (!usuarioLoginCriado.Status) { return(BadRequest(usuarioLoginCriado)); } return(authenticateApp.ValidanteAndCreateToken(usuarioLoginCriado.Body)); }
public object Post([FromBody] AuthUserViewModel usuario) { usuario = usuario ?? new AuthUserViewModel(); var authUser = new Core.Entities.AuthUser() { Email = usuario.Email, Password = usuario.Senha }; var response = appAuthenticate.ValidanteAndCreateToken(authUser); if (!response.Status) { return(BadRequest(response)); } return(response); }
public void Testar_ValidanteAndCreateToken_com_usuario_valido() { IAppAuthenticate appAuthenticate = BuilderAppAuthenticate.New() .Com(new AuthUser() { Email = validEmail, Password = validPassword }) .Build(); var authUser = new AuthUser() { Email = validEmail, Password = validPassword }; var resultAuthUser = appAuthenticate.ValidanteAndCreateToken(authUser); Assert.IsTrue(resultAuthUser.Status, "Erro no result"); }