You've already forked hotpocket
This commit is contained in:
14
services/backend/hotpocket_backend/apps/accounts/mixins.py
Normal file
14
services/backend/hotpocket_backend/apps/accounts/mixins.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import annotations
|
||||
|
||||
from django.contrib.auth.mixins import AccessMixin
|
||||
|
||||
from .checks import is_authenticated_and_active_account
|
||||
|
||||
|
||||
class AccountRequiredMixin(AccessMixin):
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if is_authenticated_and_active_account(self.request.user) is False:
|
||||
return self.handle_no_permission()
|
||||
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
Reference in New Issue
Block a user