예제 #1
0
        public static Commons.User MobileLogin(Commons.UserLogin model)
        {
            Commons.User obj = new Commons.User();
            using (IndexEntities db = new IndexEntities())
            {
                sp_MobileLogin_Result result = db.sp_MobileLogin(model.Username, Functionalities.Security.Cryptography.Encrypt(model.Password)).FirstOrDefault();

                if (result != null)
                {
                    obj.Id            = result.IdPerson;
                    obj.FirstName     = result.FirstName;
                    obj.LastName      = result.LastName;
                    obj.Nit           = result.Nit;
                    obj.SitePassword  = result.SitePassword;
                    obj.PasswordReset = result.PasswordReset;
                    obj.OAuthSite     = result.OAuthSite;
                    obj.OAuthMobile   = result.OAuthMobile;
                    obj.Active        = result.Active;
                    obj.UserName      = result.UserName;
                    obj.Roles         = Role.Get(result.UserName);
                }
                else
                {
                    obj = null;
                }
            }

            return(obj);
        }
예제 #2
0
        public HttpResponseMessage MobileResetPasswor(String UserName, String Password)
        {
            HttpResponseMessage respuesta = null;

            try
            {
                Commons.UserLogin model = new Commons.UserLogin()
                {
                    Username = UserName, Password = Functionalities.Security.Cryptography.Decrypt(Password)
                };
                Boolean result = Dal.User.PasswordResetMobile(model);

                if (result)
                {
                    respuesta = Request.CreateResponse(HttpStatusCode.OK, result);
                }
                else
                {
                    respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, "Error desconocido");
                }
            }
            catch (Exception ex)
            {
                respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, (ex.InnerException == null) ? ex.Message : ex.InnerException.Message);
            }
            return(respuesta);
        }
예제 #3
0
        public HttpResponseMessage MobileLogin(String UserName, String Password)
        {
            HttpResponseMessage respuesta = null;

            try
            {
                Commons.UserLogin model = new Commons.UserLogin()
                {
                    Username = UserName, Password = Functionalities.Security.Cryptography.Decrypt(Password)
                };
                Commons.User user = Dal.User.MobileLogin(model);

                if (user != null)
                {
                    respuesta = Request.CreateResponse(HttpStatusCode.OK, user);
                }
                else
                {
                    respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, "Credenciales incorrectas");
                }
            }
            catch (Exception ex)
            {
                respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, (ex.InnerException == null) ? ex.Message : ex.InnerException.Message);
            }
            return(respuesta);
        }
예제 #4
0
        public static Boolean SiteChangePassword(Commons.UserLogin model)
        {
            using (IndexEntities db = new IndexEntities())
            {
                db.spu_UserSitePassword(model.Username, model.Password);
            }

            return(true);
        }
예제 #5
0
        public static Boolean PasswordResetSite(Commons.UserLogin model)
        {
            using (IndexEntities db = new IndexEntities())
            {
                db.sp_SitePasswordChange(model.Username, Functionalities.Security.Cryptography.Encrypt(model.Password));
            }

            return(true);
        }
예제 #6
0
        public HttpResponseMessage ChangeSitePassword(String UserName, String Password)
        {
            Commons.UserLogin model = new Commons.UserLogin()
            {
                Username = UserName,
                Password = Password
            };

            HttpResponseMessage respuesta = null;

            try
            {
                Boolean result = Dal.User.SiteChangePassword(model);
                respuesta = Request.CreateResponse(HttpStatusCode.OK, result);
            }
            catch (Exception ex)
            {
                respuesta = Request.CreateErrorResponse(HttpStatusCode.Conflict, (ex.InnerException == null) ? ex.Message : ex.InnerException.Message);
            }
            return(respuesta);
        }