public ActionResult Login(string userName, string password) { ActionResult result; string connectionString = Config.GetConnectionString("MyWorkbench"); try { MultiTenantHelper.Authenticate(userName, password); connectionString = MultiTenantHelper.ConnectionString(connectionString); if (SecurityProvider.InitConnection(userName, password, HttpContext, XpoDataStoreProviderService, connectionString)) { result = Ok(); } else { result = Unauthorized(); } } catch { result = Unauthorized(); } return(result); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { SecurityProvider securityProvider = (SecurityProvider)validationContext.GetService(typeof(SecurityProvider)); Login login = (Login)value; if (securityProvider.InitConnection(login.UserName, login.Password)) { return(ValidationResult.Success); } return(new ValidationResult("User name or password is incorrect")); }
public ActionResult Login(string userName, string password) { ActionResult result; if (securityProvider.InitConnection(userName, password)) { result = Ok(); } else { result = Unauthorized(); } return(result); }
public ActionResult Login(string userName, string password) { ActionResult result; string connectionString = Config.GetConnectionString("XafApplication"); if (SecurityProvider.InitConnection(userName, password, HttpContext, XpoDataStoreProviderService, connectionString)) { result = Ok(); } else { result = Unauthorized(); } return(result); }
public ActionResult Login([FromBody] UserLogin data) { try { ActionResult result; string userName = data.UserName; string password = data.Password; if (securityProvider.InitConnection(userName, password)) { result = Ok(); GenHelper.WriteLog("[Log]", "[" + userName + "]Login Done:[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); } else { result = Unauthorized(); } return(result); } catch (Exception ex) { throw new Exception(ex.Message); } }