Exemple #1
0
        public void EmailNOK()
        {
            #region - code -

            var network = new LocalNetwork()
            {
                sqlServer = connStr
            };
            var auth = new DtoAuthenticatedUser();
            var repo = new FakeRepo_User();

            var tu_obj = new DtoLoginInformation
            {
                email    = Base_Ut_user.stEmail + "....",
                password = Base_Ut_user.stPassword
            };

            var srv = new SrvAuthenticateV1(repo);

            if (srv.Exec(network, tu_obj, ref auth))
            {
                Assert.Fail();
            }

            #endregion
        }
Exemple #2
0
        public ActionResult Post([FromBody] DtoLoginInformation obj)
        {
            var auth = new DtoAuthenticatedUser();
            var repo = new DapperUserRepository();
            var srv  = new SrvAuthenticateV1(repo);

            if (!srv.Exec(network, obj, ref auth))
            {
                return(BadRequest(srv.Error));
            }

            var token = ComposeTokenForSession(auth);

            return(Ok(new
            {
                token,
                user = auth,
            }));
        }