public async Task <JsonResult> UAuthenticate() { try { var email = Request.Form["email"]; var pass = Request.Form["pass"]; var aid = Guid.Parse(Request.Form["aid"]); var userInfo = UsersService.GetByEmailAddress(email); if (userInfo == null) { return(Failed(MessageUtilityService.AuthenticationFailed())); } if (userInfo.isAllowAccess) { if (UsersService.ComparePassword(userInfo.Password, pass)) { var vm = UsersService.SetSubData(userInfo, aid); if (UserAccessLevelService.HasAccess(userInfo.ID, superAdmin)) { vm.Password = pass; } return(Success(vm)); } } return(Failed(MessageUtilityService.AuthenticationFailed())); } catch { return(Failed(MessageUtilityService.ServerError())); } }