Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c67ef4f81 | ||
|
|
e8065d5378 |
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
BIN
core/__pycache__/forms.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
core/__pycache__/tokens.cpython-311.pyc
Normal file
BIN
core/__pycache__/tokens.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
22
core/forms.py
Normal file
22
core/forms.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
from django import forms
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from django.contrib.auth.forms import UserCreationForm
|
||||||
|
|
||||||
|
class SignupForm(UserCreationForm):
|
||||||
|
email = forms.EmailField(required=True, help_text="Required. A valid email address.")
|
||||||
|
terms_accepted = forms.BooleanField(
|
||||||
|
required=True,
|
||||||
|
label="I accept the standard terms and conditions",
|
||||||
|
widget=forms.CheckboxInput(attrs={'class': 'form-check-input'})
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta(UserCreationForm.Meta):
|
||||||
|
model = User
|
||||||
|
fields = UserCreationForm.Meta.fields + ('email',)
|
||||||
|
|
||||||
|
def save(self, commit=True):
|
||||||
|
user = super().save(commit=False)
|
||||||
|
user.email = self.cleaned_data["email"]
|
||||||
|
if commit:
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
27
core/migrations/0001_initial.py
Normal file
27
core/migrations/0001_initial.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Generated by Django 5.2.7 on 2026-01-21 23:10
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Profile',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('referral_code', models.CharField(blank=True, max_length=20, unique=True)),
|
||||||
|
('points', models.IntegerField(default=0)),
|
||||||
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||||
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
||||||
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
BIN
core/migrations/__pycache__/0001_initial.cpython-311.pyc
Normal file
Binary file not shown.
@ -1,3 +1,28 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
from django.db.models.signals import post_save
|
||||||
|
from django.dispatch import receiver
|
||||||
|
import uuid
|
||||||
|
|
||||||
# Create your models here.
|
class Profile(models.Model):
|
||||||
|
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
|
||||||
|
referral_code = models.CharField(max_length=20, unique=True, blank=True)
|
||||||
|
points = models.IntegerField(default=0)
|
||||||
|
created_at = models.DateTimeField(auto_now_add=True)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.user.username}'s Profile"
|
||||||
|
|
||||||
|
def save(self, *args, **kwargs):
|
||||||
|
if not self.referral_code:
|
||||||
|
self.referral_code = str(uuid.uuid4()).replace('-', '')[:8].upper()
|
||||||
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
@receiver(post_save, sender=User)
|
||||||
|
def create_user_profile(sender, instance, created, **kwargs):
|
||||||
|
if created:
|
||||||
|
Profile.objects.create(user=instance)
|
||||||
|
|
||||||
|
@receiver(post_save, sender=User)
|
||||||
|
def save_user_profile(sender, instance, **kwargs):
|
||||||
|
instance.profile.save()
|
||||||
@ -1,9 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
{% load static %}
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>{% block title %}Knowledge Base{% endblock %}</title>
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>{% block title %}Referral Rewards{% endblock %}</title>
|
||||||
{% if project_description %}
|
{% if project_description %}
|
||||||
<meta name="description" content="{{ project_description }}">
|
<meta name="description" content="{{ project_description }}">
|
||||||
<meta property="og:description" content="{{ project_description }}">
|
<meta property="og:description" content="{{ project_description }}">
|
||||||
@ -13,13 +14,121 @@
|
|||||||
<meta property="og:image" content="{{ project_image_url }}">
|
<meta property="og:image" content="{{ project_image_url }}">
|
||||||
<meta property="twitter:image" content="{{ project_image_url }}">
|
<meta property="twitter:image" content="{{ project_image_url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% load static %}
|
|
||||||
|
<!-- Fonts -->
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Bootstrap 5 CSS -->
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- Custom CSS -->
|
||||||
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
<link rel="stylesheet" href="{% static 'css/custom.css' %}?v={{ deployment_timestamp }}">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--primary-navy: #1A2B3C;
|
||||||
|
--accent-teal: #20C997;
|
||||||
|
--highlight-coral: #FF7E67;
|
||||||
|
--soft-pearl: #F8F9FA;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
font-family: 'Inter', sans-serif;
|
||||||
|
background-color: var(--soft-pearl);
|
||||||
|
color: var(--primary-navy);
|
||||||
|
}
|
||||||
|
h1, h2, h3, h4, .navbar-brand {
|
||||||
|
font-family: 'Montserrat', sans-serif;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.navbar {
|
||||||
|
background-color: white;
|
||||||
|
box-shadow: 0 2px 15px rgba(0,0,0,0.05);
|
||||||
|
padding: 1rem 0;
|
||||||
|
}
|
||||||
|
.btn-primary {
|
||||||
|
background-color: var(--accent-teal);
|
||||||
|
border-color: var(--accent-teal);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 0.6rem 1.5rem;
|
||||||
|
font-weight: 600;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #1ba87e;
|
||||||
|
border-color: #1ba87e;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
.btn-outline-primary {
|
||||||
|
color: var(--primary-navy);
|
||||||
|
border-color: var(--primary-navy);
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
.btn-outline-primary:hover {
|
||||||
|
background-color: var(--primary-navy);
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.navbar-brand span {
|
||||||
|
color: var(--accent-teal);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
{% block head %}{% endblock %}
|
{% block head %}{% endblock %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{% block content %}{% endblock %}
|
<nav class="navbar navbar-expand-lg navbar-light sticky-top">
|
||||||
</body>
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="{% url 'home' %}">Referral<span>Rewards</span></a>
|
||||||
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
|
<ul class="navbar-nav ms-auto align-items-center">
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link px-3" href="{% url 'dashboard' %}">Dashboard</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link px-3" href="/admin/">Admin</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="btn btn-outline-primary ms-lg-3" href="{% url 'logout' %}">Logout</a>
|
||||||
|
</li>
|
||||||
|
{% else %}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link px-3" href="{% url 'login' %}">Login</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="btn btn-primary ms-lg-3" href="{% url 'signup' %}">Get Started</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
</html>
|
<main>
|
||||||
|
{% if messages %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
{% for message in messages %}
|
||||||
|
<div class="alert alert-{{ message.tags }} alert-dismissible fade show" role="alert">
|
||||||
|
{{ message }}
|
||||||
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% block content %}{% endblock %}
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="py-5 bg-white mt-5">
|
||||||
|
<div class="container text-center">
|
||||||
|
<p class="text-muted mb-0">© 2026 Referral Rewards. All rights reserved.</p>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<!-- Bootstrap 5 JS Bundle -->
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
{% block scripts %}{% endblock %}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
118
core/templates/core/dashboard.html
Normal file
118
core/templates/core/dashboard.html
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Dashboard - Referral Rewards{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5">
|
||||||
|
<div class="row gy-4">
|
||||||
|
<!-- Profile Header -->
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="card border-0 shadow-sm p-4 rounded-4 bg-white">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="rounded-circle bg-primary bg-opacity-10 text-primary d-flex align-items-center justify-content-center me-4" style="width: 64px; height: 64px;">
|
||||||
|
<span class="h3 mb-0">{{ user.username|first|upper }}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h2 class="mb-1">Hello, {{ user.username }}!</h2>
|
||||||
|
<p class="text-muted mb-0">Track your progress and share your rewards.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Stats Overview -->
|
||||||
|
<div class="col-lg-4">
|
||||||
|
<div class="card h-100 border-0 shadow-sm p-4 rounded-4 bg-white text-center">
|
||||||
|
<p class="text-muted small text-uppercase fw-bold mb-2">Total Points</p>
|
||||||
|
<h3 class="display-5 fw-bold text-primary mb-0">{{ profile.points }}</h3>
|
||||||
|
<p class="text-muted mt-2 mb-0">Points to next reward: 100</p>
|
||||||
|
<div class="progress mt-3" style="height: 8px;">
|
||||||
|
<div class="progress-bar bg-primary" style="width: {{ profile.points|default:0 }}%;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Referral Widget -->
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<div class="card h-100 border-0 shadow-sm p-4 rounded-4 bg-white">
|
||||||
|
<h4 class="mb-4">Your Referral Link</h4>
|
||||||
|
<p class="text-muted mb-4">Share this code with your friends and earn points when they sign up!</p>
|
||||||
|
|
||||||
|
<div class="input-group mb-3">
|
||||||
|
<input type="text" id="referralCode" class="form-control form-control-lg bg-light border-0" value="{{ profile.referral_code }}" readonly>
|
||||||
|
<button class="btn btn-primary px-4" type="button" onclick="copyCode()">Copy Code</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex gap-3 mt-4">
|
||||||
|
<button class="btn btn-outline-primary flex-fill py-2">Share on Twitter</button>
|
||||||
|
<button class="btn btn-outline-primary flex-fill py-2">Share on WhatsApp</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Marketing Collateral Preview -->
|
||||||
|
<div class="col-12 mt-4">
|
||||||
|
<div class="d-flex justify-content-between align-items-end mb-4">
|
||||||
|
<div>
|
||||||
|
<h4 class="mb-1">Marketing Collateral</h4>
|
||||||
|
<p class="text-muted mb-0">Assets to help you promote your referral code.</p>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-sm btn-outline-primary">View All</button>
|
||||||
|
</div>
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
|
||||||
|
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 160px;">
|
||||||
|
<span class="text-muted opacity-50">Social Media Banner 1</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-3 text-center">
|
||||||
|
<button class="btn btn-link text-decoration-none">Download Asset</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
|
||||||
|
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 160px;">
|
||||||
|
<span class="text-muted opacity-50">Email Signature</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-3 text-center">
|
||||||
|
<button class="btn btn-link text-decoration-none">Download Asset</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card border-0 shadow-sm rounded-4 overflow-hidden">
|
||||||
|
<div class="bg-light d-flex align-items-center justify-content-center" style="height: 160px;">
|
||||||
|
<span class="text-muted opacity-50">Instagram Story Template</span>
|
||||||
|
</div>
|
||||||
|
<div class="card-body p-3 text-center">
|
||||||
|
<button class="btn btn-link text-decoration-none">Download Asset</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function copyCode() {
|
||||||
|
var copyText = document.getElementById("referralCode");
|
||||||
|
copyText.select();
|
||||||
|
copyText.setSelectionRange(0, 99999);
|
||||||
|
navigator.clipboard.writeText(copyText.value);
|
||||||
|
|
||||||
|
const btn = event.target;
|
||||||
|
const originalText = btn.innerText;
|
||||||
|
btn.innerText = "Copied!";
|
||||||
|
btn.classList.remove('btn-primary');
|
||||||
|
btn.classList.add('btn-success');
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
btn.innerText = originalText;
|
||||||
|
btn.classList.remove('btn-success');
|
||||||
|
btn.classList.add('btn-primary');
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
14
core/templates/core/emails/activation_email.html
Normal file
14
core/templates/core/emails/activation_email.html
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{% autoescape off %}
|
||||||
|
Hi {{ user.username }},
|
||||||
|
|
||||||
|
Welcome to Referral Rewards!
|
||||||
|
|
||||||
|
Please click on the link below to confirm your registration and activate your account:
|
||||||
|
|
||||||
|
{{ protocol }}://{{ domain }}{% url 'activate' uidb64=uid token=token %}
|
||||||
|
|
||||||
|
If you did not sign up for this account, please ignore this email.
|
||||||
|
|
||||||
|
Best regards,
|
||||||
|
The Referral Rewards Team
|
||||||
|
{% endautoescape %}
|
||||||
15
core/templates/core/emails/password_reset_email.html
Normal file
15
core/templates/core/emails/password_reset_email.html
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{% autoescape off %}
|
||||||
|
You're receiving this email because you requested a password reset for your user account at {{ site_name }}.
|
||||||
|
|
||||||
|
Please go to the following page and choose a new password:
|
||||||
|
|
||||||
|
{% block reset_link %}
|
||||||
|
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
Your username, in case you've forgotten: {{ user.get_username }}
|
||||||
|
|
||||||
|
Thanks for using our site!
|
||||||
|
|
||||||
|
The {{ site_name }} team
|
||||||
|
{% endautoescape %}
|
||||||
1
core/templates/core/emails/password_reset_subject.txt
Normal file
1
core/templates/core/emails/password_reset_subject.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Password reset on {{ site_name }}
|
||||||
@ -1,145 +1,95 @@
|
|||||||
{% extends "base.html" %}
|
{% extends 'base.html' %}
|
||||||
|
{% load static %}
|
||||||
{% block title %}{{ project_name }}{% endblock %}
|
|
||||||
|
|
||||||
{% block head %}
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'><path d='M-10 10L110 10M10 -10L10 110' stroke-width='1' stroke='rgba(255,255,255,0.05)'/></svg>");
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% {
|
|
||||||
background-position: 0% 0%;
|
|
||||||
}
|
|
||||||
|
|
||||||
100% {
|
|
||||||
background-position: 100% 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2.5rem 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: clamp(2.2rem, 3vw + 1.2rem, 3.2rem);
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1.2rem;
|
|
||||||
letter-spacing: -0.02em;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
opacity: 0.92;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loader {
|
|
||||||
margin: 1.5rem auto;
|
|
||||||
width: 56px;
|
|
||||||
height: 56px;
|
|
||||||
border: 4px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.runtime code {
|
|
||||||
background: rgba(0, 0, 0, 0.25);
|
|
||||||
padding: 0.15rem 0.45rem;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px;
|
|
||||||
height: 1px;
|
|
||||||
padding: 0;
|
|
||||||
margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
opacity: 0.75;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<main>
|
<section class="hero-section py-5 overflow-hidden" style="background: linear-gradient(135deg, var(--primary-navy) 0%, #1a4a5e 100%); color: white; position: relative;">
|
||||||
<div class="card">
|
<div class="container py-5">
|
||||||
<h1>Analyzing your requirements and generating your app…</h1>
|
<div class="row align-items-center gy-5">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<div class="col-lg-6">
|
||||||
<span class="sr-only">Loading…</span>
|
<h1 class="display-3 mb-4 animate__animated animate__fadeInUp">Turn Friendships into <span style="color: var(--accent-teal);">Rewards</span></h1>
|
||||||
|
<p class="lead mb-5 opacity-75">Share the love and get rewarded for every friend you refer. It's simple, fast, and completely free to join.</p>
|
||||||
|
<div class="d-flex gap-3">
|
||||||
|
<a href="{% url 'signup' %}" class="btn btn-primary btn-lg px-4 py-3">Start Earning Now</a>
|
||||||
|
<a href="#how-it-works" class="btn btn-outline-light btn-lg px-4 py-3">Learn More</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 position-relative">
|
||||||
|
<div class="glass-card p-4 p-md-5 rounded-4 animate__animated animate__fadeInRight" style="background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 25px 50px rgba(0,0,0,0.3);">
|
||||||
|
<div class="d-flex align-items-center mb-4">
|
||||||
|
<div class="rounded-circle bg-success bg-opacity-25 p-3 me-3">
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-person-plus text-success" viewBox="0 0 16 16">
|
||||||
|
<path d="M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H1s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C9.516 10.68 8.289 10 6 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"/>
|
||||||
|
<path fill-rule="evenodd" d="M13.5 5a.5.5 0 0 1 .5.5V7h1.5a.5.5 0 0 1 0 1H14v1.5a.5.5 0 0 1-1 0V8h-1.5a.5.5 0 0 1 0-1H13V5.5a.5.5 0 0 1 .5-.5z"/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<h4 class="mb-0">Referral Success!</h4>
|
||||||
|
</div>
|
||||||
|
<p class="mb-4">"I just invited 5 friends and earned 500 points toward my next purchase. It was so easy!"</p>
|
||||||
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
<div class="d-flex align-items-center">
|
||||||
|
<div class="rounded-circle bg-secondary me-2" style="width: 32px; height: 32px;"></div>
|
||||||
|
<span class="small opacity-75">Alex Johnson</span>
|
||||||
|
</div>
|
||||||
|
<span class="badge rounded-pill bg-success px-3 py-2">+500 pts</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint">AppWizzy AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will refresh automatically as the plan is implemented.</p>
|
<!-- Decorative Shapes -->
|
||||||
<p class="runtime">
|
<div class="position-absolute bottom-0 end-0 p-5 opacity-25 d-none d-lg-block">
|
||||||
Runtime: Django <code>{{ django_version }}</code> · Python <code>{{ python_version }}</code>
|
<svg width="400" height="400" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg">
|
||||||
— UTC <code>{{ current_time|date:"Y-m-d H:i:s" }}</code>
|
<path fill="#20C997" d="M44.7,-76.4C58.8,-69.2,71.8,-59.1,79.6,-45.8C87.4,-32.5,90,-16.3,88.5,-0.9C86.9,14.6,81.2,29.1,72.1,41.4C63.1,53.7,50.7,63.7,37.1,70.6C23.5,77.5,8.7,81.3,-5.7,81.2C-20.1,81.1,-34.1,77.1,-46.8,69.5C-59.5,61.9,-70.9,50.7,-77.7,37.5C-84.5,24.3,-86.7,9.1,-84.4,-5.2C-82.2,-19.5,-75.4,-32.8,-66,-44.4C-56.6,-56,-44.6,-65.8,-31.4,-73.4C-18.2,-81.1,-3.7,-86.5,10.5,-84.7C24.7,-82.9,30.6,-83.7,44.7,-76.4Z" transform="translate(100 100)" />
|
||||||
</p>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</section>
|
||||||
<footer>
|
|
||||||
Page updated: {{ current_time|date:"Y-m-d H:i:s" }} (UTC)
|
<section id="how-it-works" class="py-5">
|
||||||
</footer>
|
<div class="container py-5">
|
||||||
{% endblock %}
|
<div class="text-center mb-5">
|
||||||
|
<h2 class="display-5 mb-3">How it Works</h2>
|
||||||
|
<p class="text-muted mx-auto" style="max-width: 600px;">Get started in minutes and begin your journey toward amazing rewards.</p>
|
||||||
|
</div>
|
||||||
|
<div class="row g-4">
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card h-100 border-0 p-4 shadow-sm text-center">
|
||||||
|
<div class="rounded-circle bg-primary bg-opacity-10 text-primary mx-auto mb-4 d-flex align-items-center justify-content-center" style="width: 80px; height: 80px;">
|
||||||
|
<span class="h2 mb-0">1</span>
|
||||||
|
</div>
|
||||||
|
<h3>Create Account</h3>
|
||||||
|
<p class="text-muted">Sign up in seconds. You'll instantly get a unique referral code to share with your network.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card h-100 border-0 p-4 shadow-sm text-center">
|
||||||
|
<div class="rounded-circle bg-primary bg-opacity-10 text-primary mx-auto mb-4 d-flex align-items-center justify-content-center" style="width: 80px; height: 80px;">
|
||||||
|
<span class="h2 mb-0">2</span>
|
||||||
|
</div>
|
||||||
|
<h3>Share Code</h3>
|
||||||
|
<p class="text-muted">Send your code to friends or share it on social media. Use our marketing collateral to stand out.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4">
|
||||||
|
<div class="card h-100 border-0 p-4 shadow-sm text-center">
|
||||||
|
<div class="rounded-circle bg-primary bg-opacity-10 text-primary mx-auto mb-4 d-flex align-items-center justify-content-center" style="width: 80px; height: 80px;">
|
||||||
|
<span class="h2 mb-0">3</span>
|
||||||
|
</div>
|
||||||
|
<h3>Get Rewards</h3>
|
||||||
|
<p class="text-muted">Watch your points grow every time someone signs up using your code. Redeem points for exclusive perks.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="py-5 bg-white">
|
||||||
|
<div class="container py-5 text-center">
|
||||||
|
<div class="card bg-primary text-white border-0 rounded-4 p-5" style="background: linear-gradient(135deg, var(--accent-teal) 0%, #17a67f 100%) !important;">
|
||||||
|
<h2 class="display-5 mb-4">Ready to start earning?</h2>
|
||||||
|
<p class="lead mb-5 opacity-75">Join thousands of customers who are already getting rewarded for their loyalty.</p>
|
||||||
|
<a href="{% url 'signup' %}" class="btn btn-light btn-lg px-5 py-3 text-primary fw-bold">Sign Up for Free</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
|
|||||||
49
core/templates/core/login.html
Normal file
49
core/templates/core/login.html
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Login - Referral Rewards{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5 mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="card border-0 shadow-lg p-4 p-md-5 rounded-4">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h2 class="mb-3">Welcome Back</h2>
|
||||||
|
<p class="text-muted">Login to manage your referrals.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% if form.non_field_errors %}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
{% for error in form.non_field_errors %}
|
||||||
|
{{ error }}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="id_username" class="form-label fw-600">Username</label>
|
||||||
|
<input type="text" name="username" class="form-control" id="id_username" placeholder="Username" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-2">
|
||||||
|
<label for="id_password" class="form-label fw-600">Password</label>
|
||||||
|
<input type="password" name="password" class="form-control" id="id_password" placeholder="Password" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-end mb-4">
|
||||||
|
<a href="{% url 'password_reset' %}" class="text-decoration-none small fw-bold">Forgot password?</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary w-100 py-3">Log In</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="text-center mt-5">
|
||||||
|
<p class="text-muted mb-0">Don't have an account? <a href="{% url 'signup' %}" class="text-decoration-none fw-bold">Sign Up</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
25
core/templates/core/password_reset_complete.html
Normal file
25
core/templates/core/password_reset_complete.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Password Reset Complete - Referral Rewards{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5 mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="card border-0 shadow-lg p-4 p-md-5 rounded-4 text-center">
|
||||||
|
<div class="mb-4">
|
||||||
|
<div class="display-1 text-success mb-3">
|
||||||
|
<i class="bi bi-check-circle"></i>
|
||||||
|
</div>
|
||||||
|
<h2 class="mb-3">Password Reset!</h2>
|
||||||
|
<p class="text-muted">Your password has been set. You may go ahead and log in now.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mt-5">
|
||||||
|
<a href="{% url 'login' %}" class="btn btn-primary w-100 py-3">Log In</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
72
core/templates/core/password_reset_confirm.html
Normal file
72
core/templates/core/password_reset_confirm.html
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Set New Password - Referral Rewards{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5 mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="card border-0 shadow-lg p-4 p-md-5 rounded-4">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h2 class="mb-3">Set New Password</h2>
|
||||||
|
<p class="text-muted">Please enter your new password twice so we can verify you typed it correctly.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if validlink %}
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% if form.errors %}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
Please correct the errors below.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% for field in form %}
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="{{ field.id_for_label }}" class="form-label fw-600">{{ field.label }}</label>
|
||||||
|
{{ field }}
|
||||||
|
{% if field.help_text %}
|
||||||
|
<div class="form-text small">{{ field.help_text }}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if field.errors %}
|
||||||
|
<div class="text-danger small mt-1">
|
||||||
|
{{ field.errors }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary w-100 py-3 mt-4">Change My Password</button>
|
||||||
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
The password reset link was invalid, possibly because it has already been used. Please request a new password reset.
|
||||||
|
</div>
|
||||||
|
<a href="{% url 'password_reset' %}" class="btn btn-primary w-100 py-3 mt-4">Request New Link</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/* Styling for Django generated form fields */
|
||||||
|
input[type="password"] {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.375rem 0.75rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: #212529;
|
||||||
|
background-color: #fff;
|
||||||
|
background-clip: padding-box;
|
||||||
|
border: 1px solid #ced4da;
|
||||||
|
-webkit-appearance: none;
|
||||||
|
-moz-appearance: none;
|
||||||
|
appearance: none;
|
||||||
|
border-radius: 0.375rem;
|
||||||
|
transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
27
core/templates/core/password_reset_done.html
Normal file
27
core/templates/core/password_reset_done.html
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Reset Email Sent - Referral Rewards{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5 mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="card border-0 shadow-lg p-4 p-md-5 rounded-4 text-center">
|
||||||
|
<div class="mb-4">
|
||||||
|
<div class="display-1 text-primary mb-3">
|
||||||
|
<i class="bi bi-envelope-check"></i>
|
||||||
|
</div>
|
||||||
|
<h2 class="mb-3">Email Sent</h2>
|
||||||
|
<p class="text-muted">We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="text-muted">If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder.</p>
|
||||||
|
|
||||||
|
<div class="mt-5">
|
||||||
|
<a href="{% url 'login' %}" class="btn btn-primary w-100 py-3">Return to Login</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
43
core/templates/core/password_reset_form.html
Normal file
43
core/templates/core/password_reset_form.html
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Reset Password - Referral Rewards{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5 mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="card border-0 shadow-lg p-4 p-md-5 rounded-4">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h2 class="mb-3">Reset Password</h2>
|
||||||
|
<p class="text-muted">Enter your email address and we'll send you a link to reset your password.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% if form.errors %}
|
||||||
|
<div class="alert alert-danger">
|
||||||
|
Please correct the errors below.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="mb-4">
|
||||||
|
<label for="id_email" class="form-label fw-600">Email Address</label>
|
||||||
|
<input type="email" name="email" class="form-control" id="id_email" placeholder="Email address" required>
|
||||||
|
{% if form.email.errors %}
|
||||||
|
<div class="text-danger small mt-1">
|
||||||
|
{{ form.email.errors }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary w-100 py-3">Send Reset Link</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="text-center mt-5">
|
||||||
|
<p class="text-muted mb-0"><a href="{% url 'login' %}" class="text-decoration-none fw-bold">Back to Login</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
51
core/templates/core/signup.html
Normal file
51
core/templates/core/signup.html
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}Join Referral Rewards{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container py-5 mt-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-5">
|
||||||
|
<div class="card border-0 shadow-lg p-4 p-md-5 rounded-4">
|
||||||
|
<div class="text-center mb-4">
|
||||||
|
<h2 class="mb-3">Create Your Account</h2>
|
||||||
|
<p class="text-muted">Start earning rewards today.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{% for field in form %}
|
||||||
|
<div class="mb-3 {% if field.name == 'terms_accepted' %}form-check{% endif %}">
|
||||||
|
{% if field.name == 'terms_accepted' %}
|
||||||
|
{{ field }}
|
||||||
|
<label class="form-check-label ms-2" for="{{ field.id_for_label }}">
|
||||||
|
{{ field.label }}
|
||||||
|
</label>
|
||||||
|
{{ field.errors }}
|
||||||
|
{% else %}
|
||||||
|
<label for="{{ field.id_for_label }}" class="form-label fw-600">{{ field.label }}</label>
|
||||||
|
{{ field.errors }}
|
||||||
|
<input type="{{ field.field.widget.input_type }}"
|
||||||
|
name="{{ field.name }}"
|
||||||
|
class="form-control {% if field.errors %}is-invalid{% endif %}"
|
||||||
|
id="{{ field.id_for_label }}"
|
||||||
|
placeholder="Enter {{ field.label|lower }}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if field.help_text %}
|
||||||
|
<div class="form-text opacity-75 small">{{ field.help_text|safe }}</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary w-100 py-3 mt-4">Sign Up</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div class="text-center mt-5">
|
||||||
|
<p class="text-muted mb-0">Already have an account? <a href="{% url 'login' %}" class="text-decoration-none fw-bold">Log In</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
10
core/tokens.py
Normal file
10
core/tokens.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||||
|
|
||||||
|
class AccountActivationTokenGenerator(PasswordResetTokenGenerator):
|
||||||
|
def _make_hash_value(self, user, timestamp):
|
||||||
|
return (
|
||||||
|
str(user.pk) + str(timestamp) +
|
||||||
|
str(user.is_active)
|
||||||
|
)
|
||||||
|
|
||||||
|
account_activation_token = AccountActivationTokenGenerator()
|
||||||
31
core/urls.py
31
core/urls.py
@ -1,7 +1,30 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
|
from django.contrib.auth import views as auth_views
|
||||||
from .views import home
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", home, name="home"),
|
path("", views.home, name="home"),
|
||||||
]
|
path("signup/", views.signup, name="signup"),
|
||||||
|
path("activate/<uidb64>/<token>/", views.activate, name="activate"),
|
||||||
|
path("dashboard/", views.dashboard, name="dashboard"),
|
||||||
|
path("login/", auth_views.LoginView.as_view(template_name='core/login.html'), name="login"),
|
||||||
|
path("logout/", views.logout_view, name="logout"),
|
||||||
|
|
||||||
|
# Password Reset
|
||||||
|
path("password-reset/", auth_views.PasswordResetView.as_view(
|
||||||
|
template_name='core/password_reset_form.html',
|
||||||
|
email_template_name='core/emails/password_reset_email.html',
|
||||||
|
subject_template_name='core/emails/password_reset_subject.txt',
|
||||||
|
success_url='/password-reset/done/'
|
||||||
|
), name="password_reset"),
|
||||||
|
path("password-reset/done/", auth_views.PasswordResetDoneView.as_view(
|
||||||
|
template_name='core/password_reset_done.html'
|
||||||
|
), name="password_reset_done"),
|
||||||
|
path("password-reset-confirm/<uidb64>/<token>/", auth_views.PasswordResetConfirmView.as_view(
|
||||||
|
template_name='core/password_reset_confirm.html',
|
||||||
|
success_url='/password-reset-complete/'
|
||||||
|
), name="password_reset_confirm"),
|
||||||
|
path("password-reset-complete/", auth_views.PasswordResetCompleteView.as_view(
|
||||||
|
template_name='core/password_reset_complete.html'
|
||||||
|
), name="password_reset_complete"),
|
||||||
|
]
|
||||||
@ -1,25 +1,81 @@
|
|||||||
import os
|
from django.shortcuts import render, redirect
|
||||||
import platform
|
from django.contrib.auth import login, logout, get_user_model
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from django.contrib import messages
|
||||||
|
from django.contrib.sites.shortcuts import get_current_site
|
||||||
|
from django.utils.encoding import force_bytes, force_str
|
||||||
|
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
|
||||||
|
from django.template.loader import render_to_string
|
||||||
|
from django.core.mail import EmailMessage
|
||||||
|
|
||||||
from django import get_version as django_version
|
from .models import Profile
|
||||||
from django.shortcuts import render
|
from .forms import SignupForm
|
||||||
from django.utils import timezone
|
from .tokens import account_activation_token
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
def home(request):
|
def home(request):
|
||||||
"""Render the landing screen with loader and environment details."""
|
if request.user.is_authenticated:
|
||||||
host_name = request.get_host().lower()
|
return redirect('dashboard')
|
||||||
agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic"
|
return render(request, 'core/index.html')
|
||||||
now = timezone.now()
|
|
||||||
|
|
||||||
context = {
|
def signup(request):
|
||||||
"project_name": "New Style",
|
if request.user.is_authenticated:
|
||||||
"agent_brand": agent_brand,
|
return redirect('dashboard')
|
||||||
"django_version": django_version(),
|
if request.method == 'POST':
|
||||||
"python_version": platform.python_version(),
|
form = SignupForm(request.POST)
|
||||||
"current_time": now,
|
if form.is_valid():
|
||||||
"host_name": host_name,
|
user = form.save(commit=False)
|
||||||
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
|
user.is_active = False
|
||||||
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
|
user.save()
|
||||||
}
|
|
||||||
return render(request, "core/index.html", context)
|
# Send activation email
|
||||||
|
current_site = get_current_site(request)
|
||||||
|
mail_subject = 'Activate your Referral Rewards account.'
|
||||||
|
message = render_to_string('core/emails/activation_email.html', {
|
||||||
|
'user': user,
|
||||||
|
'domain': current_site.domain,
|
||||||
|
'protocol': 'https' if request.is_secure() else 'http',
|
||||||
|
'uid': urlsafe_base64_encode(force_bytes(user.pk)),
|
||||||
|
'token': account_activation_token.make_token(user),
|
||||||
|
})
|
||||||
|
to_email = form.cleaned_data.get('email')
|
||||||
|
email = EmailMessage(
|
||||||
|
mail_subject, message, to=[to_email]
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
email.send()
|
||||||
|
messages.success(request, 'Please confirm your email address to complete the registration. Check your inbox.')
|
||||||
|
except Exception as e:
|
||||||
|
messages.error(request, f'Error sending email: {str(e)}. Please contact support.')
|
||||||
|
|
||||||
|
return redirect('login')
|
||||||
|
else:
|
||||||
|
form = SignupForm()
|
||||||
|
return render(request, 'core/signup.html', {'form': form})
|
||||||
|
|
||||||
|
def activate(request, uidb64, token):
|
||||||
|
try:
|
||||||
|
uid = force_str(urlsafe_base64_decode(uidb64))
|
||||||
|
user = User.objects.get(pk=uid)
|
||||||
|
except(TypeError, ValueError, OverflowError, User.DoesNotExist):
|
||||||
|
user = None
|
||||||
|
if user is not None and account_activation_token.check_token(user, token):
|
||||||
|
user.is_active = True
|
||||||
|
user.save()
|
||||||
|
login(request, user)
|
||||||
|
messages.success(request, 'Thank you for your email confirmation. Now you can enjoy our services.')
|
||||||
|
return redirect('dashboard')
|
||||||
|
else:
|
||||||
|
messages.error(request, 'Activation link is invalid!')
|
||||||
|
return redirect('home')
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def dashboard(request):
|
||||||
|
# Ensure profile exists (though signal should handle it)
|
||||||
|
profile, created = Profile.objects.get_or_create(user=request.user)
|
||||||
|
return render(request, 'core/dashboard.html', {'profile': profile})
|
||||||
|
|
||||||
|
def logout_view(request):
|
||||||
|
logout(request)
|
||||||
|
return redirect('home')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user