core/base.html & settings.py updated for email-based login & logout

This commit is contained in:
Disco DeDisco
2026-02-01 16:19:07 -05:00
parent d236ab9d69
commit 36f4182a4f
2 changed files with 30 additions and 13 deletions

View File

@@ -146,3 +146,10 @@ LOGGING = {
"root": {"handlers": ["console"], "level": "INFO"}, "root": {"handlers": ["console"], "level": "INFO"},
}, },
} }
# Email Settings
EMAIL_HOST = "smtp.mailgun.org"
EMAIL_HOST_USER = os.environ["EMAIL_HOST_USER"]
EMAIL_HOST_PASSWORD = os.environ["EMAIL_HOST_PASSWORD"]
EMAIL_PORT = 587
EMAIL_USER_TLS = True

View File

@@ -17,20 +17,30 @@
<a href="/" class="navbar-brand"> <a href="/" class="navbar-brand">
<h1>Welcome, Earthman</h1> <h1>Welcome, Earthman</h1>
</a> </a>
<form method="POST" action="{% url "send_login_email" %}"> {% if user.email %}
<div class="input-group"> <span class="navbar-text">Logged in as {{ user.email }}</span>
<label for="id_email_input" class="navbar-text me-2"> <form action="TODO" method="POST">
enter email for login:
</label>
<input
id="id_email_input"
class="form-control"
name="email"
placeholder="your@email.here"
>
{% csrf_token %} {% csrf_token %}
</div> <button id="id_logout" class="btn btn-outline-secondary" type="submit">
</form> Log Out
</button>
</form>
{% else %}
<form method="POST" action="{% url "send_login_email" %}">
<div class="input-group">
<label for="id_email_input" class="navbar-text me-2">
enter email for login:
</label>
<input
id="id_email_input"
name="email"
class="form-control"
placeholder="your@email.here"
>
{% csrf_token %}
</div>
</form>
{% endif %}
</div> </div>
</nav> </nav>