Seamus hace 4 meses
padre
commit
f34b2b284c
Se han modificado 2 ficheros con 14 adiciones y 14 borrados
  1. 12 12
      ERP.Core/Service/AuthService.cs
  2. 2 2
      ERP.Framework/WebApi/BaseRepository.cs

+ 12 - 12
ERP.Core/Service/AuthService.cs

@@ -43,24 +43,24 @@ namespace ERP.Core.Service
                 throw new Exception(string.Format(_localizer["User.NotExist"], loginName));
             }
 
-            //CheckUserStatus(user);
+            CheckUserStatus(user);
 
             CheckLogin(securityConfig, password, user);
 
             return new LoginUser();
         }
 
-        //private void CheckUserStatus(SysUser user)
-        //{
-        //    if (user.UserStatus == StatusEnum.Enable)
-        //    {
-        //        return;
-        //    }
-        //    else if (user.UserStatus == StatusEnum.Disable)
-        //    {
-        //        throw new Exception(string.Format(_localizer["User.Bloked"], user.UserName));
-        //    }
-        //}
+        private void CheckUserStatus(SysUser user)
+        {
+            if (user.UserStatus == StatusEnum.Enable)
+            {
+                return;
+            }
+            else if (user.UserStatus == StatusEnum.Disable)
+            {
+                throw new Exception(string.Format(_localizer["User.Bloked"], user.UserName));
+            }
+        }
 
         private void CheckLogin(SecurityConfig securityConfig, string password, SysUser loginUser)
         {

+ 2 - 2
ERP.Framework/WebApi/BaseRepository.cs

@@ -18,7 +18,7 @@ namespace ERP.Framework.WebApi
             _context = context;
         }
 
-        public T? FirstOrDefault(Expression<Func<T, bool>> exp = null)
+        public T? FirstOrDefault(Expression<Func<T, bool>>? exp = null)
         {
             return Filter(exp).FirstOrDefault();
         }
@@ -60,7 +60,7 @@ namespace ERP.Framework.WebApi
             }
         }
 
-        private IQueryable<T> Filter(Expression<Func<T, bool>> exp)
+        private IQueryable<T> Filter(Expression<Func<T, bool>>? exp)
         {
             var dbSet = _context.Set<T>().AsNoTracking().AsQueryable();
             if (exp != null)