add simple user management
This commit is contained in:
parent
0e268c3be9
commit
5a0304242b
@ -58,7 +58,7 @@ REST_FRAMEWORK = {
|
||||
# ]
|
||||
|
||||
ROOT_URLCONF = 'ofu_app.urls'
|
||||
|
||||
TEMPLATES_DIR = os.path.join(BASE_DIR, 'templates'),
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django_jinja.backend.Jinja2',
|
||||
@ -160,3 +160,5 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
# Media files should be stored here
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
LOGIN_REDIRECT_URL = 'home'
|
||||
|
||||
@ -15,10 +15,14 @@ Including another URLconf
|
||||
"""
|
||||
from django.conf.urls import url, include
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import views as auth_views
|
||||
from ofu_app import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^login/$', auth_views.login, {'template_name': 'registration/login.jinja'}, name='login'),
|
||||
url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
# url(r'^signup/$', core_views.signup, name='signup'),
|
||||
|
||||
url(r'^$', views.home, name="home"),
|
||||
# -- Apps --
|
||||
|
||||
@ -22,8 +22,12 @@
|
||||
|
||||
{% block body %}
|
||||
<div class="row">
|
||||
<div class="col-2">
|
||||
|
||||
<div class="col-2 text-center">
|
||||
{% if request.user.is_authenticated() %}
|
||||
<a href="{{ url('logout') }}"><i class="fa fa-user" aria-hidden="true"></i></a>
|
||||
{% else %}
|
||||
<a href="{{ url('login') }}"><i class="fa fa-sign-in" aria-hidden="true"></i></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-8">
|
||||
{% block headline %}{% endblock %}</div>
|
||||
|
||||
31
ofu_app/templates/registration/login.jinja
Normal file
31
ofu_app/templates/registration/login.jinja
Normal file
@ -0,0 +1,31 @@
|
||||
{% extends 'base.jinja' %}
|
||||
|
||||
{% block headline %}<h3 class="text-center">BaStA Login</h3>{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-12 text-center p-3 bg-light text-dark">
|
||||
<h3>Login</h3>
|
||||
<form method="post" action="{{ url('login') }}">
|
||||
{% csrf_token %}
|
||||
{% if form.errors %}
|
||||
<div class="message is-danger">
|
||||
<div class="message-body">
|
||||
Your username and password didn't match. Please try again.
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<label for="id_username" class="label">Username:</label>
|
||||
<p class="control">
|
||||
<input id="id_username" class="input" maxlength="254" name="username" type="text">
|
||||
</p>
|
||||
<label for="id_password" class="label">Password:</label>
|
||||
<p class="control">
|
||||
<input id="id_password" class="input" name="password" type="password">
|
||||
</p>
|
||||
<input type="submit" class="button is-pulled-right" value="Login"/>
|
||||
<input type="hidden" name="next" value="{{ next }}"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
0
ofu_app/templates/registration/sign_up.jinja
Normal file
0
ofu_app/templates/registration/sign_up.jinja
Normal file
Reference in New Issue
Block a user