diff --git a/apps/acls/models/login_acl.py b/apps/acls/models/login_acl.py index ce678e236..7191fe4b6 100644 --- a/apps/acls/models/login_acl.py +++ b/apps/acls/models/login_acl.py @@ -20,18 +20,18 @@ class LoginACL(UserBaseACL): def is_action(self, action): return self.action == action - def create_confirm_ticket(self, request): + def create_confirm_ticket(self, request, user): from tickets import const from tickets.models import ApplyLoginTicket from orgs.models import Organization - title = _('Login confirm') + ' {}'.format(request.user) + title = _('Login confirm') + ' {}'.format(user) login_ip = get_request_ip(request) if request else '' login_ip = login_ip or '0.0.0.0' login_city = get_ip_city(login_ip) login_datetime = local_now_display() data = { 'title': title, - 'applicant': request.user, + 'applicant': user, 'apply_login_ip': login_ip, 'org_id': Organization.ROOT_ID, 'apply_login_city': login_city, diff --git a/apps/authentication/mixins.py b/apps/authentication/mixins.py index 647aac773..e859fe4de 100644 --- a/apps/authentication/mixins.py +++ b/apps/authentication/mixins.py @@ -375,13 +375,13 @@ class AuthACLMixin: return if not acl.is_action(acl.ActionChoices.review): return - self.get_ticket_or_create(acl) + self.get_ticket_or_create(acl, user) self.check_user_login_confirm() - def get_ticket_or_create(self, acl): + def get_ticket_or_create(self, acl, user): ticket = self.get_ticket() if not ticket or ticket.is_state(ticket.State.closed): - ticket = acl.create_confirm_ticket(self.request) + ticket = acl.create_confirm_ticket(self.request, user) self.request.session['auth_ticket_id'] = str(ticket.id) return ticket