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)
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)
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)