Accounts Framework added
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Ekaropolus 2025-05-16 19:51:14 -06:00
parent 9046deeffa
commit e92f86a298
42 changed files with 1563 additions and 22 deletions

1
.gitignore vendored
View File

@ -27,3 +27,4 @@ db.sqlite3
# System
.DS_Store
pxy_city_digital_twins/__backup__/
Dockerfile.dev

View File

@ -0,0 +1,15 @@
version: "3.8"
services:
web:
build:
context: .
dockerfile: Dockerfile.dev
command: >
sh -c "python manage.py migrate &&
python manage.py runserver 0.0.0.0:8000"
ports:
- "8011:8000"
volumes:
- .:/app
- ./staticfiles:/app/staticfiles

View File

@ -19,14 +19,22 @@ ALLOWED_HOSTS = os.getenv("ALLOWED_HOSTS", "").split(",")
# Application definition
INSTALLED_APPS = [
# Django built-in apps
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites", # Required for allauth
# App modules
# Allauth
"allauth",
"allauth.account",
"allauth.socialaccount",
"allauth.socialaccount.providers.github", # GitHub login only
# Your custom apps
"core",
"pxy_de",
"pxy_cr",
@ -42,14 +50,34 @@ INSTALLED_APPS = [
"pxy_dashboard.apps",
"pxy_dashboard.components",
"pxy_dashboard.layouts",
# Third-party apps
"crispy_forms",
"crispy_bootstrap5",
]
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "bootstrap5"
SITE_ID = 1
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend", # default
"allauth.account.auth_backends.AuthenticationBackend", # allauth support
]
LOGIN_REDIRECT_URL = "/"
ACCOUNT_LOGOUT_REDIRECT_URL = "/accounts/login/"
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"allauth.account.middleware.AccountMiddleware", # ← Add this line
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
@ -59,7 +87,10 @@ ROOT_URLCONF = "polisplexity.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(BASE_DIR, "templates")],
"DIRS": [
os.path.join(BASE_DIR, "templates"),
os.path.join(BASE_DIR, "pxy_dashboard", "templates"),
],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
@ -73,6 +104,8 @@ TEMPLATES = [
},
]
WSGI_APPLICATION = "polisplexity.wsgi.application"
# Database
@ -132,3 +165,12 @@ CSRF_TRUSTED_ORIGINS = [
# Support for secure reverse proxy (e.g., Nginx or Hostinger HTTPS proxy)
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
EMAIL_HOST = "smtp.hostinger.com"
EMAIL_PORT = 465
EMAIL_USE_SSL = True
EMAIL_HOST_USER = "noreply@polisplexity.tech" # Cambia esto por tu correo real
EMAIL_HOST_PASSWORD = os.getenv("EMAIL_HOST_PASSWORD") # Mejor usar .env
DEFAULT_FROM_EMAIL = "Polisplexity <noreply@polisplexity.tech>"

View File

@ -25,14 +25,15 @@ admin.site.index_title = "Welcome to Polisplexity City Technologies Portal"
urlpatterns = [
path("admin/", admin.site.urls),
path("accounts/", include("allauth.urls")), # ← Add this line
path('', include('pxy_dashboard.urls')),
path('core', include('core.urls')),
path('', include('pxy_city_digital_twins.urls')),
path('pxy_whatsapp/', include('pxy_whatsapp.urls')),
path('bots/', include('pxy_bots.urls')), # Webhook URL: /bots/webhook/<bot_name>/
path('bots/', include('pxy_bots.urls')),
path('pxy_meta_pages/', include('pxy_meta_pages.urls', namespace='pxy_meta_pages')),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

View File

@ -0,0 +1 @@
../pxy_dashboard/account/login.html

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}
{% load account %}

View File

@ -1,5 +1,6 @@
{% extends "account/base.html" %}
{% load static crispy_forms_tags %}
{% extends "pxy_dashboard/account/base.html" %}
{% load static crispy_forms_tags socialaccount %}
{% block title %}Log In{% endblock title %}
@ -36,6 +37,16 @@
</p>
</div>
{% load socialaccount %}
{% if True %}
<div class="text-center my-3">
<a href="{% provider_login_url 'github' %}" class="btn btn-dark">
<i class="mdi mdi-github me-1"></i> Sign in with GitHub
</a>
</div>
{% endif %}
<form method="POST" action="{% url 'account_login' %}" novalidate>
{% csrf_token %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load static i18n crispy_forms_tags %}
{% block title %}{% trans "Recover Password" %}{% endblock title %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load static i18n crispy_forms_tags %}
{% block title %}{% trans "Password Reset" %}{% endblock title %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load static i18n crispy_forms_tags %}
{% block title %}{% trans "Change Password" %}{% endblock title %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load static i18n crispy_forms_tags %}
{% block title %}{% trans "Change Password" %}{% endblock title %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load static i18n crispy_forms_tags %}
{% block title %}{% trans "Register" %}{% endblock title %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}

View File

@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "pxy_dashboard/account/base.html" %}
{% load i18n %}

View File

@ -3,7 +3,7 @@
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<script>document.write(new Date().getFullYear())</script> © Jidox - Coderthemes.com
<script>document.write(new Date().getFullYear())</script> © Polisplexity
</div>
<div class="col-md-6">
<div class="text-md-end footer-links d-none d-md-block">

View File

@ -4,6 +4,5 @@
<!-- App css -->
<link href="{% static 'dashboard/css/app.min.css' %}" rel="stylesheet" type="text/css" id="app-style" />
<link href="{% static 'dashboard/css/app.main.css' %}" rel="stylesheet" type="text/css" id="app-style" />
<!-- Icons css -->
<link href="{% static 'dashboard/css/icons.min.css' %}" rel="stylesheet" type="text/css" />

View File

@ -0,0 +1,49 @@
{% extends "pxy_dashboard/account/base.html" %}
{% load static %}
{% block title %}Sign In Via GitHub{% endblock %}
{% block body_attr %}
class="authentication-bg position-relative"
{% endblock %}
{% block page_content %}
{% include "pxy_dashboard/partials/background.html" %}
<div class="account-pages pt-2 pt-sm-5 pb-4 pb-sm-5 position-relative">
<div class="container">
<div class="row justify-content-center">
<div class="col-xxl-4 col-lg-5">
<div class="card">
<div class="card-header pt-4 text-center">
<div class="auth-brand mb-0">
<a href="{% url 'index' %}" class="logo-dark">
<span><img src="{% static 'dashboard/images/logo-dark.png' %}" alt="dark logo" height="28"></span>
</a>
<a href="{% url 'index' %}" class="logo-light">
<span><img src="{% static 'dashboard/images/logo.png' %}" alt="logo" height="28"></span>
</a>
</div>
</div>
<div class="card-body p-4 text-center">
<h4 class="text-dark-50 fw-bold">Sign In Via GitHub</h4>
<p class="text-muted mb-4">You are about to sign in using your GitHub account.</p>
<form method="post" action="">
{% csrf_token %}
<button class="btn btn-primary w-100" type="submit">Continue</button>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer footer-alt">
<span class="text-white-50">
<script>document.write(new Date().getFullYear())</script> © Jidox - Coderthemes.com
</span>
</footer>
{% endblock %}

View File

@ -143,4 +143,14 @@ shapely
pyproj
matplotlib
dj-database-url>=1.0.0
# Core auth system with social login
django-allauth>=0.52.0
# 2FA support (TOTP, backup tokens, etc.)
django-otp>=1.1.5
django-two-factor-auth>=1.15.1
django-crispy-forms>=2.1
crispy-bootstrap5>=0.6

File diff suppressed because it is too large Load Diff

1
templates/account/* Symbolic link
View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/*

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/account_inactive.html

1
templates/account/base.html Symbolic link
View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/base.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/email.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/email_confirm.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/login.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/logout.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/password_change.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/password_reset.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/password_reset_done.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/password_reset_from_key_done.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/password_set.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/signup.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/signup_closed.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/verification_sent.html

View File

@ -0,0 +1 @@
../../pxy_dashboard/templates/pxy_dashboard/account/verified_email_required.html