Пример #1
0
        protected bool loadHandlerEmail(HttpRequest request)
        {
            string authorization = request.Headers["Authorization"];
            string token         = authorization.Substring("Bearer ".Length);

            _usuarioInfo = _jwtTokenService.DecodeJwtToken(token);

            Usuari usuari = _context.Usuaris.FirstOrDefault(x => x.Email == _usuarioInfo.Email);

            if (usuari == null)
            {
                return(false);
            }

            usuari.Pass = _encrypt.Desencriptar(usuari.Pass, _usuarioInfo.Id.ToString());

            _handler.connectar(usuari.Email, usuari.Pass, usuari.Email);
            return(_handler.conectado());
        }