core/base.html & settings.py updated for email-based login & logout
This commit is contained in:
@@ -146,3 +146,10 @@ LOGGING = {
|
||||
"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
|
||||
|
||||
@@ -17,20 +17,30 @@
|
||||
<a href="/" class="navbar-brand">
|
||||
<h1>Welcome, Earthman</h1>
|
||||
</a>
|
||||
<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"
|
||||
class="form-control"
|
||||
name="email"
|
||||
placeholder="your@email.here"
|
||||
>
|
||||
{% if user.email %}
|
||||
<span class="navbar-text">Logged in as {{ user.email }}</span>
|
||||
<form action="TODO" method="POST">
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
</form>
|
||||
<button id="id_logout" class="btn btn-outline-secondary" type="submit">
|
||||
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>
|
||||
</nav>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user