Adds registration templates

This commit is contained in:
nikolark committed 2013-12-25 20:44:03 +01:00
1 parent 6cfe58902d
commit 65f25a31b0
12 files changed
+159 -10

No files matched your search

+4 -2
View File
@@ -22,8 +22,10 @@
</header>
<!-- Main content -->
{% block content %}
{% endblock %}
<div class="container">
{% block content %}
{% endblock %}
</div>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"></script>
@@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block title %}Logget ut{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-12">
Du har blitt logget ut, vil du <a href="{% url "home" %}">logge inn</a> igjen?
</div>
</div>
{% endblock %}
+4 -2
View File
@@ -1,6 +1,8 @@
{% extends "base.html" %}
{% block content %}
<div class="container">
{% include "registration/login_form.html" %}
<div class="row">
<div class="col-md-12">
{% include "registration/login_form.html" %}
</div>
</div>
{% endblock %}
@@ -0,0 +1,10 @@
{% extends "base.html" %}
{% block title %}Passord endret{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-12">
Passordet ditt er endret og kan <strong>med en gang</strong> brukes på våre tjenester.<br />
Du kan nå gå tilbake til <a href="/">din profil</a>.
</div>
</div>
{% endblock %}
@@ -0,0 +1,36 @@
{% extends "base.html" %}
{% block title %}Endre passordet ditt{% endblock %}
{%block header%}
{% include "nav.html" with active="password_change" %}
{%endblock%}
{% block content %}
<div class="row">
<div class="col-md-5">
<form method="post" class="form-horizontal">
<fieldset>
<legend>Endre passordet mitt.</legend>
{% if form.non_field_errors %}
{{ form.non_field_errors }}<br />
{% endif %}
{% csrf_token %}
<div class="control-group">
<label class="control-label" for="id_new_password1">Nytt passord:</label>
<div class="controls">
{{ form.new_password1 }} {{ form.new_password1.errors }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_new_password2">Nytt passord (gjenta):</label>
<div class="controls">
{{ form.new_password2 }} {{ form.new_password2.errors }}
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Endre passordet mitt</button> <a href="/accounts/profile/" class="btn">Avbryt</a>
</div>
</fieldset>
</form>
</div>
</div>
{% endblock %}
@@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block title %}Passordendring vellykket{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-5">
Strålende, passordet ditt har blitt endret! Du kan nå forsøke å <a href="/">logge inn</a> med ditt nye passord.
</div>
</div>
{% endblock %}
@@ -0,0 +1,38 @@
{% extends "base.html" %}
{% block title %}Bekreft nytt passord{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-5">
<!--Presents a form for entering a new password.-->
{% if validlink %}
Vennligst velg et nytt passord. Ditt nye passord må være på miminum 8 tegn.
<form method="post">
<fieldset>
<legend>Endre passordet mitt.</legend>
{{ form.non_field_errors }}
{% csrf_token %}
<div class="control-group">
<label class="control-label" for="id_new_password1">Nytt passord: </label>
<div class="controls">
{{ form.new_password1 }}{{ form.new_password1.errors }}
</div>
</div>
<div class="control-group">
<label class="control-label" for="id_new_password2">Nytt passord (gjenta): </label>
<div class="controls">
{{ form.new_password2 }}{{ form.new_password2.errors }}
</div>
</div>
<div class="form-actions">
<button type="submit">Endre passordet mitt</button>
</div>
</fieldset>
</form>
{% else %}
Nytt-passord-lenken er ikke gyldig eller har allerede blitt brukt.
<!--The password reset link is not valid or allready used.-->
{% endif %}
</div>
</div>
{% endblock %}
@@ -0,0 +1,9 @@
{% extends "base.html" %}
{% block title %}Passordmail er sent{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-5">
Vi har nå sendt deg en epost med informasjon om hvordan du kan velge et nytt passord. Sjekk eposten din.
</div>
</div>
{% endblock %}
@@ -0,0 +1,2 @@
Noen har bedt om at passordet for brukeren {{ user.username }} med epostadresse {{ email }} skal endres. Vennligst følg lenken nedenfor for å sette et nytt passord:
{{ protocol }}://{{ site_name }}{% url django.contrib.auth.views.password_reset_confirm uidb36=uid token=token %}
@@ -0,0 +1,29 @@
{% extends "base.html" %}
{% block title %}Få nytt passord{% endblock %}
{% block content %}
<div class="row">
<div class="col-md-12">
For å få tilsendt passord og brukernavn fyll ut epostadressen din.
<!--Allows a user to reset their password by generating a one-time use link that can be used to reset the password, and sending that link to the user's registered email address.-->
<form method="post" class="form-horizontal">
<fieldset>
<legend>Gi meg et nytt passord</legend>
{% if form.non_field_errors %}
{{ form.non_field_errors }}<br />
{% endif %}
{% csrf_token %}
<div class="control-group">
<label class="control-label" for="id_email">Epostadresse:</label>
<div class="controls">
{{ form.email }} {{ form.email.errors }}
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn btn-primary">Gi meg et nytt passord</button> <a href="/accounts/profile/" class="btn">Avbryt</a>
</div>
</fieldset>
</form>
</div>
</div>
{% endblock %}
@@ -0,0 +1 @@
[Duskenweb] Reset password
+6 -6
View File
@@ -5,21 +5,21 @@ from django.views import generic
from . import user_api_conn # Note: initialized in __init__.py
def home(request):
def home(request, template_name='index.html'):
if request.user.is_authenticated():
return redirect('profile')
return render(request, 'index.html')
return render(request, template_name)
@login_required
def profile(request):
return render(request, 'profile.html')
def profile(request, template_name='profile.html'):
return render(request, template_name)
@login_required
def members_list(request):
def members_list(request, template_name='members_index.html'):
# TODO put these two lines somewhere else, on authenticate?
if not user_api_conn.is_authenticated() and request.user.duskenaccesstoken:
user_api_conn.set_access_token(request.user.duskenaccesstoken.access_token)
members_list = user_api_conn.members.get_list()
return render(request, 'members_index.html', locals())
return render(request, template_name, locals())