예제 #1
0
 def _check_login_acl(self, user, ip):
     # ACL 限制用户登录
     from acls.models import LoginACL
     is_allowed = LoginACL.allow_user_to_login(user, ip)
     if not is_allowed:
         raise errors.LoginIPNotAllowed(username=user.username,
                                        request=self.request)
예제 #2
0
 def _check_login_acl(self, user, ip):
     # ACL 限制用户登录
     from acls.models import LoginACL
     is_allowed = LoginACL.allow_user_to_login(user, ip)
     if not is_allowed:
         raise self.raise_credential_error(
             error=errors.reason_acl_not_allow)
예제 #3
0
 def _check_login_acl(self, user, ip):
     # ACL 限制用户登录
     is_allowed, limit_type = LoginACL.allow_user_to_login(user, ip)
     if not is_allowed:
         if limit_type == 'ip':
             raise errors.LoginIPNotAllowed(username=user.username, request=self.request)
         elif limit_type == 'time':
             raise errors.TimePeriodNotAllowed(username=user.username, request=self.request)