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); }
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); }
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); }
public static Boolean SiteChangePassword(Commons.UserLogin model) { using (IndexEntities db = new IndexEntities()) { db.spu_UserSitePassword(model.Username, model.Password); } return(true); }
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); }
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); }