mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-06 22:14:12 +00:00
feat: page login
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,14 +1,17 @@
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.http import HttpResponseForbidden
|
||||
from django.http import HttpResponseForbidden, HttpResponseRedirect
|
||||
|
||||
|
||||
def group_required(groupName):
|
||||
def decorator(view_function):
|
||||
def wrapper(request, *args, **kwargs):
|
||||
if request.user.groups.filter(name=groupName).exists():
|
||||
return view_function(request, *args, **kwargs)
|
||||
if request.user.is_authenticated:
|
||||
if request.user.groups.filter(name=groupName).exists():
|
||||
return view_function(request, *args, **kwargs)
|
||||
else:
|
||||
return HttpResponseForbidden('tu nao tem acesso rapa')
|
||||
else:
|
||||
return HttpResponseForbidden('tu nao tem acesso rapa')
|
||||
return HttpResponseForbidden('Direcionar para tela de login aqui')
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@ INSTALLED_APPS = [
|
||||
'payments',
|
||||
'balcao',
|
||||
'orders',
|
||||
'login',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
@@ -20,6 +20,7 @@ from django.urls import path, include
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('', include('home.urls')),
|
||||
path('login/', include('login.urls')),
|
||||
path('products/', include('products.urls')),
|
||||
path('mesas/', include('mesas.urls')),
|
||||
path('typePay/', include('typePay.urls')),
|
||||
|
||||
Reference in New Issue
Block a user