Seamus 3 bulan lalu
induk
melakukan
f34b2b284c
2 mengubah file dengan 14 tambahan dan 14 penghapusan
  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)