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_user_login_confirm_if_need(self, user): ip = self.get_request_ip() is_allowed, confirm_setting = LoginACL.allow_user_confirm_if_need(user, ip) if self.request.session.get('auth_confirm') or not is_allowed: return self.get_ticket_or_create(confirm_setting) self.check_user_login_confirm()
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)