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"},
|
"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">
|
<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>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user