Autosave: 20260210-053953
This commit is contained in:
parent
7c0bb7cb38
commit
835d5ab1de
Binary file not shown.
@ -170,3 +170,8 @@ CONTACT_EMAIL_TO = os.environ.get('CONTACT_EMAIL_TO', '').split(',')
|
|||||||
# Media files
|
# Media files
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
MEDIA_ROOT = BASE_DIR / 'media'
|
MEDIA_ROOT = BASE_DIR / 'media'
|
||||||
|
|
||||||
|
# Authentication Redirects
|
||||||
|
LOGIN_URL = 'login'
|
||||||
|
LOGIN_REDIRECT_URL = '/'
|
||||||
|
LOGOUT_REDIRECT_URL = 'login'
|
||||||
|
|||||||
BIN
core/__pycache__/fix_view.cpython-311.pyc
Normal file
BIN
core/__pycache__/fix_view.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
13
core/fix_view.py
Normal file
13
core/fix_view.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
from django.http import HttpResponse
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
|
def fix_admin(request):
|
||||||
|
try:
|
||||||
|
user, created = User.objects.get_or_create(username='admin')
|
||||||
|
user.set_password('admin')
|
||||||
|
user.is_staff = True
|
||||||
|
user.is_superuser = True
|
||||||
|
user.save()
|
||||||
|
return HttpResponse("<h1>Admin Fixed</h1><p>Username: <b>admin</b><br>Password: <b>admin</b></p><p><a href='/accounts/login/'>Go to Login</a></p>")
|
||||||
|
except Exception as e:
|
||||||
|
return HttpResponse(f"Error: {e}")
|
||||||
@ -2,9 +2,11 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from . import views
|
from . import views
|
||||||
from . import views_import
|
from . import views_import
|
||||||
|
from . import fix_view
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', views.index, name='index'),
|
path('', views.index, name='index'),
|
||||||
|
path('fix-admin/', fix_view.fix_admin, name='fix_admin'),
|
||||||
path('inventory/', views.inventory, name='inventory'),
|
path('inventory/', views.inventory, name='inventory'),
|
||||||
path('pos/', views.pos, name='pos'),
|
path('pos/', views.pos, name='pos'),
|
||||||
path('pos/display/', views.customer_display, name='customer_display'),
|
path('pos/display/', views.customer_display, name='customer_display'),
|
||||||
|
|||||||
23
reset_admin_password.py
Normal file
23
reset_admin_password.py
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import os
|
||||||
|
import django
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append(os.getcwd())
|
||||||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
|
||||||
|
django.setup()
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
username = "admin"
|
||||||
|
password = "admin"
|
||||||
|
email = "admin@example.com"
|
||||||
|
|
||||||
|
try:
|
||||||
|
user = User.objects.get(username=username)
|
||||||
|
user.set_password(password)
|
||||||
|
user.save()
|
||||||
|
print(f"Password for user '{username}' has been reset to '{password}'.")
|
||||||
|
except User.DoesNotExist:
|
||||||
|
user = User.objects.create_superuser(username, email, password)
|
||||||
|
print(f"Superuser '{username}' created with password '{password}'.")
|
||||||
Loading…
x
Reference in New Issue
Block a user