Merge branch 'william' into 'master'
Enhancements of the UI See merge request ungleich-public/ungleich-user!2
This commit is contained in:
commit
a951932118
22 changed files with 658 additions and 208 deletions
|
@ -56,6 +56,29 @@
|
||||||
border: 2px solid #8396C4;
|
border: 2px solid #8396C4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.choicered-btn {
|
||||||
|
min-width: 110px;
|
||||||
|
background-color: red;
|
||||||
|
color: #fff;
|
||||||
|
border: 2px solid red;
|
||||||
|
padding: 4px 10px;
|
||||||
|
transition: 0.3s all ease-out;
|
||||||
|
}
|
||||||
|
.choicered-btn:focus,
|
||||||
|
.choicered-btn:hover,
|
||||||
|
.choicered-btn:active {
|
||||||
|
color: red;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
.choicered-btn-faded {
|
||||||
|
background-color: #8396C4;
|
||||||
|
border: 2px solid #8396C4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 767px) {
|
@media (max-width: 767px) {
|
||||||
.h1-thin {
|
.h1-thin {
|
||||||
font-size: 27px;
|
font-size: 27px;
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
|
{% block title %}
|
||||||
<title>ungleich</title>
|
{% endblock %}
|
||||||
|
|
||||||
<!-- Bootstrap Core CSS -->
|
<!-- Bootstrap Core CSS -->
|
||||||
<link href="{% static 'datacenterlight/css/bootstrap-3.3.7.min.css' %}" rel="stylesheet">
|
<link href="{% static 'datacenterlight/css/bootstrap-3.3.7.min.css' %}" rel="stylesheet">
|
||||||
|
@ -47,14 +47,14 @@
|
||||||
<!-- End Google Analytics -->
|
<!-- End Google Analytics -->
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body style="overflow-x: hidden">
|
||||||
<!-- cms_toolbar %}-->
|
<!-- cms_toolbar %}-->
|
||||||
|
|
||||||
{% block navbar %}
|
{% block navbar %}
|
||||||
{% include "includes/_navbar_transparent.html" %}
|
{% include "includes/_navbar_transparent.html" %}
|
||||||
{% endblock navbar %}
|
{% endblock navbar %}
|
||||||
|
|
||||||
<div class="{% if request.user.is_authenticated %}content-dashboard{% endif %}">
|
<div class="{% if request.user.is_authenticated %}content-dashboard{% endif %}" style="min-height: auto">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,29 @@
|
||||||
<title> Userdata changed. </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> The data for {{user}} has been changed. </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> Success! </title>
|
||||||
<ul>
|
{% endblock %}
|
||||||
<li> Username: {{user}} </li>
|
|
||||||
<li> Firstname: {{firstname}} </li>
|
|
||||||
<li> Lastname: {{lastname}} </li>
|
|
||||||
<li> Email: {{email}} </li>
|
{% block content %}
|
||||||
</ul>
|
<div class="auth-container">
|
||||||
<br><br>
|
<div class="auth-bg"></div>
|
||||||
<form action={% url 'index' %} method="get">
|
<div class="auth-center">
|
||||||
<input type="submit" value="Back to indexpage">
|
<div class="auth-content">
|
||||||
</form>
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading allcaps">{% trans " Data successfully updated." %}</h1>
|
||||||
|
<form action="{% url 'index' %}" method="get" class="form" novalidated>
|
||||||
|
<hr>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Back to indexpage" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,7 +1,28 @@
|
||||||
<title> Password for {{user}} changed. </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> The password for {{user}} has been changed. </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> Password Updated. </title>
|
||||||
<form action={% url 'index' %} method="get">
|
{% endblock %}
|
||||||
<input type="submit" value="Back to indexpage">
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="auth-container">
|
||||||
|
<div class="auth-bg"></div>
|
||||||
|
<div class="auth-center">
|
||||||
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h2 class="section-heading allcaps">{% trans " Password successfully updated " %}</h2>
|
||||||
|
<form action="{% url 'index' %}" method="get" class="form" novalidated>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Back to indexpage" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -1,20 +1,44 @@
|
||||||
<title> Changing the password for {{user}} </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> Changing the password for {{user}} </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> Changing the password for {{user}} </title>
|
||||||
<form action={% url 'index' %} method="get">
|
{% endblock %}
|
||||||
<input type="submit" value="Back to indexpage">
|
|
||||||
</form>
|
|
||||||
<br><br>
|
|
||||||
To change the password for {{user}}, please supply
|
{% block content %}
|
||||||
<form action={% url 'change_password' %} method="post">
|
<div class="auth-container">
|
||||||
{% csrf_token %}
|
<div class="auth-bg"></div>
|
||||||
<br>The old password:<br>
|
<div class="auth-center">
|
||||||
<input type="password" name="oldpassword" id="oldpassword">
|
<div class="auth-content">
|
||||||
<br><br>The new password (at least 8 characters):<br>
|
<div class="auth-box">
|
||||||
<input type="password" name="password1" id="password1">
|
<h1 class="section-heading allcaps">{% trans " Password change " %}</h1>
|
||||||
<br>Please repeat the new Password:<br>
|
<form action="{% url 'change_password' %}" method="post" class="form" novalidated>
|
||||||
<input type="password" name="password2" id="password2">
|
{% csrf_token %}
|
||||||
<br><br>
|
<br>
|
||||||
<input type="submit" value="Submit">
|
<div class="form-group">
|
||||||
</form>
|
<label class="sr-only control-label" for="password1">oldpassword</label>
|
||||||
|
<input type="password" name="oldpassword" class="form-control" placeholder="Type your current password" title="" required="" id="oldpassword">
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="password1">password1</label>
|
||||||
|
<input type="password" name="password1" class="form-control" placeholder="New Password (at least 8 characters):" title="" required="" id="password1">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="password2">password2</label>
|
||||||
|
<input type="password" name="password2" class="form-control" placeholder="Please confirm your new Password:" title="" required="" id="password2">
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Change Password" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,19 +1,43 @@
|
||||||
<title> Changing user data for {{user}} </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
<title> Changing user data for {{user}} </title>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="auth-container">
|
||||||
|
<div class="auth-bg"></div>
|
||||||
|
<div class="auth-center">
|
||||||
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading allcaps">{% trans " Update your info " %} </h1>
|
||||||
|
<form action="{% url 'change_data' %}" method="post" class="form" novalidated>
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="firstname">firstname</label>
|
||||||
|
<input type="text" name="firstname" placeholder="firstname" value="{{firstname}}" class="form-control" required="" id="firstname">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="lastname">lastname</label>
|
||||||
|
<input type="text" name="lastname" placeholder="lastname" value="{{lastname}}" class="form-control" required="" id="lastname">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="email">email</label>
|
||||||
|
<input type="text" name="email" placeholder="email" value="{{email}}" class="form-control" required="" id="email">
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Change User Data" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
<h2> Changing user data for {{user}} </h2>
|
|
||||||
<br><br>
|
|
||||||
<form action={% url 'index' %} method="get">
|
|
||||||
<input type="submit" value="Back to indexpage">
|
|
||||||
</form>
|
|
||||||
<br><br>
|
|
||||||
<form action={% url 'change_data' %} method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<br>Firstname:<br>
|
|
||||||
<input type="text" name="firstname" id="firstname" value="{{firstname}}">
|
|
||||||
<br><br>Lastname:<br>
|
|
||||||
<input type="text" name="lastname" id="lastname" value="{{lastname}}">
|
|
||||||
<br><br>Email:<br>
|
|
||||||
<input type="text" name="email" id="email" value="{{email}}">
|
|
||||||
<br><br>
|
|
||||||
<input type="submit" value="Submit">
|
|
||||||
</form>
|
|
||||||
|
|
|
@ -1,18 +1,39 @@
|
||||||
<title> Deleting an Account </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> Deleting an Account </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> Deleting Account </title>
|
||||||
<form action={% url 'index' %} method="get">
|
{% endblock %}
|
||||||
<input type="submit" value="Back to indexpage">
|
|
||||||
</form>
|
|
||||||
<br><br>
|
|
||||||
To delete an account, please type the username and password below:
|
{% block content %}
|
||||||
<form action={% url 'account_delete' %} method="post">
|
<div class="auth-container">
|
||||||
{% csrf_token %}
|
<div class="auth-bg"></div>
|
||||||
<br><br>Username:<br>
|
<div class="auth-center">
|
||||||
<input type="text" name="username" id="username">
|
<div class="auth-content">
|
||||||
<br><br>Password:<br>
|
<div class="auth-box">
|
||||||
<input type="password" name="password" id="password">
|
<h1 class="section-heading allcaps">{% trans " Enter your credentials to confirm " %}</h1>
|
||||||
<br><br>
|
<form action="{% url 'account_delete' %}" method="post" class="form" novalidated>
|
||||||
<input type="submit" value="Submit">
|
{% csrf_token %}
|
||||||
</form>
|
<br><br>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="username">username</label>
|
||||||
|
<input type="text" name="username" class="form-control" placeholder="Username" title="" required="" id="username">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="password">password</label>
|
||||||
|
<input type="password" name="password" class="form-control" placeholder="Password" title="" required="" id="password">
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choicered-btn btn-block">
|
||||||
|
{% trans "Delete Account" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -1,7 +1,28 @@
|
||||||
<title> Deleted user {{user}} </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> The user {{user}} was deleted from our system. </h2>
|
{% block title %}
|
||||||
<br>
|
<title> Deleted user {{user}} </title>
|
||||||
<form action={% url 'index' %} method="get">
|
{% endblock %}
|
||||||
<input type="submit" value="Back to indexpage">
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="auth-container">
|
||||||
|
<div class="auth-bg"></div>
|
||||||
|
<div class="auth-center">
|
||||||
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading allcaps">{% trans " User Removed " %}</h1>
|
||||||
|
<form action="{% url 'index' %}" method="get" class="form" novalidated>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Back to indexpage" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,17 +1,34 @@
|
||||||
<title> An error has occurred! </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
<title>An error has occurred!</title>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="container">
|
||||||
|
<div class="auth-bg"></div>
|
||||||
|
<div class="auth-center">
|
||||||
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading">{% trans " We are sorry, an error has occurred. " %}</h1>
|
||||||
|
<br>
|
||||||
|
<div class="auth-footer">
|
||||||
|
While trying to {{service}}, an error was encountered: <strong>{{error}}</strong>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
{% if urlname %}
|
||||||
|
<br>You can: <br><br>
|
||||||
|
<a class="btn choice-btn mr-2" href="{% url urlname %}" role="button">Go back and try again</a>
|
||||||
|
{% endif %}
|
||||||
|
<a class="btn choice-btn ml-2" href="{% url 'index' %}" role="button">Go to the indexpage</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
<h2> We are sorry, an error has occured while handling your request. </h2>
|
|
||||||
|
|
||||||
While trying to {{service}}, an error was encountered: {{error}}
|
|
||||||
<br><br>
|
|
||||||
You can try to:
|
|
||||||
<br>
|
|
||||||
{% if urlname %}
|
|
||||||
<form action={% url urlname %} method="get">
|
|
||||||
<input type="submit" value="Go back and try again">
|
|
||||||
</form>
|
|
||||||
<br>or<br>
|
|
||||||
{% endif %}
|
|
||||||
<form action={% url 'index' %} method="get">
|
|
||||||
<input type="submit" value="Go to the indexpage">
|
|
||||||
</form>
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
<footer>
|
<footer>
|
||||||
<div class="container">
|
<div class="row">
|
||||||
<div class="row">
|
<div class="container">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<ul class="list-inline">
|
<ul class="list-inline">
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
{% extends "base_short.html" %}
|
{% extends "base_short.html" %}
|
||||||
{% load i18n staticfiles bootstrap3 %}
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
<title>ungleich</title>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="auth-container">
|
<div class="auth-container">
|
||||||
|
@ -17,7 +21,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<p class="red">{{form.non_field_errors|striptags}}</p>
|
<p class="red">{{form.non_field_errors|striptags}}</p>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<button type="submit" class="btn choice-btn">
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
{% trans "Log in" %}
|
{% trans "Log in" %}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,11 +1,29 @@
|
||||||
<title> Login failed! </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> Sorry, but your login has failed </h2>
|
{% block title %}
|
||||||
<br><br>This service runs for our LDAP users, so maybe you don't already have an LDAP account with us? If so, please register one.
|
<title>Login failed!</title>
|
||||||
<form action={% url 'register' %} method="get">
|
{% endblock %}
|
||||||
<input type="submit" value="Register an user">
|
|
||||||
</form>
|
|
||||||
<br><br>
|
{% block content %}
|
||||||
<form action={% url 'index' %} method="get">
|
<div class="container">
|
||||||
<input type="submit" value="Back to indexpage">
|
<div class="auth-bg"></div>
|
||||||
</form>
|
<div class="auth-center">
|
||||||
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading">{% trans " Sorry, but your login has failed. " %}</h1>
|
||||||
|
<br>
|
||||||
|
<div class="auth-footer">
|
||||||
|
{% trans " This service runs for our LDAP users, so maybe you don't already have an LDAP account with us? If so, please register one " %}
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<br><br>
|
||||||
|
<a class="btn choice-btn mr-2" href="{% url 'register' %}" role="button">Register an user</a>
|
||||||
|
<a class="btn choice-btn ml-2" href="{% url 'index' %}" role="button">Back to the indexpage</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,7 +1,29 @@
|
||||||
<title> You must be logged in to access this page </title>
|
|
||||||
|
|
||||||
<h2> You must be logged in to access this page </h2>
|
{% extends "base_short.html" %}
|
||||||
<br><br>
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
<form action={% url 'index' %} method="get">
|
|
||||||
<input type="submit" value="Back to indexpage">
|
{% block title %}
|
||||||
</form>
|
<title> You must be logged in to access this page </title>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="auth-container">
|
||||||
|
<div class="auth-bg"></div>
|
||||||
|
<div class="auth-center">
|
||||||
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading allcaps">{% trans " You need to login to access " %}</h1>
|
||||||
|
<form action="{% url 'index' %}" method="get" class="form" novalidated>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Back to indexpage" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -1,27 +1,60 @@
|
||||||
<title> Register an user at ungleich </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> Register an user at ungleich </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> Register an user at ungleich </title>
|
||||||
<form action={% url 'index' %} method="get">
|
{% endblock %}
|
||||||
<input type="submit" value="Back to indexpage">
|
|
||||||
</form>
|
{% block content %}
|
||||||
<br><br>
|
<div class="auth-container">
|
||||||
To register yourself an user, please fill out the fields below:
|
<div class="auth-bg"></div>
|
||||||
<br>
|
<div class="auth-center">
|
||||||
<form action={% url 'register' %} method="post">
|
<div class="auth-content">
|
||||||
{% csrf_token %}
|
<div class="auth-box">
|
||||||
<br>Username (alphanumeric):<br>
|
<h1 class="section-heading allcaps">{% trans "Sign Up" %}</h1>
|
||||||
<input type="text" name="username" id="username">
|
{% include 'includes/_messages.html' %}
|
||||||
<br>Password (at least 8 characters):<br>
|
<form action="{% url 'register' %}" method="post" class="form" novalidated>
|
||||||
<input type="password" name="password1" id="password1">
|
{% csrf_token %}
|
||||||
<br>Please confirm your Password:<br>
|
<div class="form-group">
|
||||||
<input type="password" name="password2" id="password2">
|
<label class="sr-only control-label" for="username">Username</label>
|
||||||
<br>Firstname:<br>
|
<input type="text" name="username" class="form-control" placeholder="Username (alphanumeric)" title="" required="" id="username">
|
||||||
<input type="text" name="firstname" id="firstname">
|
</div>
|
||||||
<br>Lastname:<br>
|
<div class="form-group">
|
||||||
<input type="text" name="lastname" id="lastname">
|
<label class="sr-only control-label" for="password1">password1</label>
|
||||||
<br>Emailaddress:<br>
|
<input type="password" name="password1" class="form-control" placeholder="Password (at least 8 characters):" title="" required="" id="password1">
|
||||||
<input type="text" name="email" id="email">
|
</div>
|
||||||
<br>
|
<div class="form-group">
|
||||||
<input type="submit" value="Submit">
|
<label class="sr-only control-label" for="password2">password2</label>
|
||||||
</form>
|
<input type="password" name="password2" class="form-control" placeholder="Please confirm your Password:" title="" required="" id="password2">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="firstname">First Name</label>
|
||||||
|
<input type="text" name="firstname" class="form-control" placeholder="firstname" title="" required="" id="firstname">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="lastname">Last Name</label>
|
||||||
|
<input type="text" name="lastname" class="form-control" placeholder="lastname" title="" required="" id="lastname">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="id_email">Email</label>
|
||||||
|
<input type="text" name="email" class="form-control" placeholder="Email" title="" required="" id="email">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<p class="red">{{form.non_field_errors|striptags}}</p>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Register" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<div class="auth-footer">
|
||||||
|
<div>
|
||||||
|
{% trans "If you already have an account" %} <a href="{% url 'index' %}">{% trans "Sign In" %}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,13 +1,34 @@
|
||||||
<title> Password reset </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> Password reset </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> Password reset </title>
|
||||||
To reset your password, please enter your username below. You will get an email with a link to change your password.
|
{% endblock %}
|
||||||
<br><br>
|
|
||||||
<form action={% url 'reset_password' %} method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
Username:<br>
|
{% block content %}
|
||||||
<input type="text" name="user" id="user">
|
<div class="auth-container">
|
||||||
<br>
|
<div class="auth-bg"></div>
|
||||||
<input type="submit" value="Submit">
|
<div class="auth-center">
|
||||||
</form>
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading allcaps">{% trans " Password Reset " %}</h1>
|
||||||
|
<p class="text-center">{% trans "Please enter your username below. You will get an email with a link to change your password." %}</p>
|
||||||
|
<form action="{% url 'reset_password' %}" method="post" class="form" novalidated>
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="user">user</label>
|
||||||
|
<input type="text" name="user" class="form-control" placeholder="User" title="" required="" id="user">
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Submit" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -1,14 +1,66 @@
|
||||||
<title> Set new password for {{user}} </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> Please set new password for {{user}} </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> Set new password for {{user}} </title>
|
||||||
<form action={% url 'reset' %} method="post">
|
{% endblock %}
|
||||||
{% csrf_token %}
|
|
||||||
New Password:<br>
|
|
||||||
<input type="password" name="password1" id="password1">
|
{% block content %}
|
||||||
<br>Please confirm new password:<br>
|
<div class="auth-container">
|
||||||
<input type="password" name="password2" id="password2">
|
<div class="auth-bg"></div>
|
||||||
<br>
|
<div class="auth-center">
|
||||||
<input type="hidden" name="user" id="user" value="{{user}}">
|
<div class="auth-content">
|
||||||
<input type="submit" value="Submit">
|
<div class="auth-box">
|
||||||
</form>
|
<h1 class="section-heading allcaps">{% trans "Please set new password for {{user}} " %}</h1>
|
||||||
|
{% include 'includes/_messages.html' %}
|
||||||
|
<form action="{% url 'reset' %}" method="post" class="form">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="password1">password1</label>
|
||||||
|
<input type="password" name="password1" class="form-control" placeholder="New Password (at least 8 characters):" title="" required="" id="password1">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="sr-only control-label" for="password2">password2</label>
|
||||||
|
<input type="password" name="password2" class="form-control" placeholder="Please confirm your Password:" title="" required="" id="password2">
|
||||||
|
</div>
|
||||||
|
<input type="hidden" name="user" id="user" value="{{user}}">
|
||||||
|
<p class="red">{{form.non_field_errors|striptags}}</p>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn">
|
||||||
|
{% trans "Submit" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<input type='hidden' name='next' value='{{request.GET.next}}'/>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{##}
|
||||||
|
{##}
|
||||||
|
{##}
|
||||||
|
{#<title></title>#}
|
||||||
|
{##}
|
||||||
|
{#<h2> </h2>#}
|
||||||
|
{#<br><br>#}
|
||||||
|
{#<form action={% url 'reset' %} method="post">#}
|
||||||
|
{# {% csrf_token %}#}
|
||||||
|
{# New Password:<br>#}
|
||||||
|
{# <input type="password" name="password1" id="password1">#}
|
||||||
|
{# <br>Please confirm new password:<br>#}
|
||||||
|
{# <input type="password" name="password2" id="password2">#}
|
||||||
|
{# <br>#}
|
||||||
|
{# <input type="hidden" name="user" id="user" value="{{user}}">#}
|
||||||
|
{# <input type="submit" value="Submit">#}
|
||||||
|
{#</form>#}
|
||||||
|
|
|
@ -1,10 +1,29 @@
|
||||||
<title> Reset request processed and confirmation email sent </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> Reset request processed and confirmation email sent </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> Reset request processed and confirmation email sent </title>
|
||||||
You will shortly get the confirmation email to confirm that you wish to reset the password for {{user}}.<br>
|
{% endblock %}
|
||||||
Please follow the link in the email to reset your password.
|
|
||||||
<br><br>
|
|
||||||
<form action={% url 'index' %} method="get">
|
|
||||||
<input type="submit" value="Back to indexpage">
|
{% block content %}
|
||||||
</form>
|
<div class="auth-container">
|
||||||
|
<div class="auth-bg"></div>
|
||||||
|
<div class="auth-center">
|
||||||
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading allcaps">{% trans " Reset request processed " %}</h1>
|
||||||
|
<p class="text-center">{% trans "You will shortly get the confirmation email. Please follow the instructions sent to reset your password." %}</p>
|
||||||
|
<form action="{% url 'index' %}" method="get" class="form" novalidated>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Back to indexpage" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,7 +1,29 @@
|
||||||
<title> User {{ user }} created. </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> User {{ user }} was successfully created. </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title> User {{ user }} created. </title>
|
||||||
<form action={% url 'index' %} method="get">
|
{% endblock %}
|
||||||
<input type="submit" value="Back to Indexpage">
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="auth-container">
|
||||||
|
<div class="auth-bg"></div>
|
||||||
|
<div class="auth-center">
|
||||||
|
<div class="auth-content">
|
||||||
|
<div class="auth-box">
|
||||||
|
<h1 class="section-heading allcaps">{% trans " Success " %}</h1>
|
||||||
|
<p class="text-center">{% trans "User was successfully created." %}</p>
|
||||||
|
<form action="{% url 'index' %}" method="get" class="form" novalidated>
|
||||||
|
<div class="text-center">
|
||||||
|
<button type="submit" class="btn choice-btn btn-block">
|
||||||
|
{% trans "Back to indexpage" %}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -1,24 +1,30 @@
|
||||||
<title> Options for {{user}} </title>
|
{% extends "base_short.html" %}
|
||||||
|
{% load i18n staticfiles bootstrap3 %}
|
||||||
|
|
||||||
<h2> Welcome, {{user}} </h2>
|
{% block title %}
|
||||||
<br><br>
|
<title>Options for {{user}}</title>
|
||||||
You have the following options:
|
{% endblock %}
|
||||||
<br>
|
|
||||||
<form action={% url 'change_data' %} method="get">
|
|
||||||
<input type="submit" value="Change your userdata">
|
{% block content %}
|
||||||
</form>
|
<div class="auth-container">
|
||||||
<br>
|
<div class="auth-bg"></div>
|
||||||
<form action={% url 'change_password' %} method="get">
|
<div class="auth-center">
|
||||||
<input type="submit" value="Change your password">
|
<div class="auth-content">
|
||||||
</form>
|
<div class="auth-box">
|
||||||
<br>
|
<h1 class="section-heading allcaps">{% trans "Welcome," %} {{user}}</h1><br><br>
|
||||||
<form action={% url 'reset_password' %} method="get">
|
<form class="form">
|
||||||
<input type="submit" value="Reset your password">
|
<a class="btn choice-btn btn-block" href="{% url 'change_data' %}" role="button">{% trans "Change your userdata" %}</a><br>
|
||||||
</form>
|
<a class="btn choice-btn btn-block" href="{% url 'change_password' %}" role="button">Change your password</a><br>
|
||||||
<br>
|
<a class="btn choicered-btn btn-block" href="{% url 'logout' %}" role="button">{% trans "Logout" %}</a><br><br>
|
||||||
<form action={% url 'account_delete' %} method="get">
|
</form>
|
||||||
<input type="submit" value="Delete your account">
|
<br>
|
||||||
</form>
|
<hr>
|
||||||
<form action={% url 'logout' %} method="get">
|
<div class="text-center">
|
||||||
<input type="submit" value="Logout">
|
<a href="{% url 'account_delete' %}">Delete your account</a><br>
|
||||||
</form>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
13
dal/urls.py
13
dal/urls.py
|
@ -4,10 +4,21 @@ from django.conf.urls import url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Import the classes for the views
|
# Import the classes for the views
|
||||||
from .views import Register, ChangeData, ChangePassword, ResetPassword, DeleteAccount, Index, LogOut, ResetRequest
|
from .views import (
|
||||||
|
Register,
|
||||||
|
ChangeData,
|
||||||
|
ChangePassword,
|
||||||
|
ResetPassword,
|
||||||
|
DeleteAccount,
|
||||||
|
Index,
|
||||||
|
LogOut,
|
||||||
|
ResetRequest,
|
||||||
|
UserCreateAPI
|
||||||
|
)
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('register/', Register.as_view(), name="register"),
|
path('register/', Register.as_view(), name="register"),
|
||||||
|
path('create/', UserCreateAPI.as_view(), name="create"),
|
||||||
path('changedata/', ChangeData.as_view(), name="change_data"),
|
path('changedata/', ChangeData.as_view(), name="change_data"),
|
||||||
path('resetpassword/', ResetPassword.as_view(), name="reset_password"),
|
path('resetpassword/', ResetPassword.as_view(), name="reset_password"),
|
||||||
path('changepassword/', ChangePassword.as_view(), name="change_password"),
|
path('changepassword/', ChangePassword.as_view(), name="change_password"),
|
||||||
|
|
77
dal/views.py
77
dal/views.py
|
@ -2,12 +2,15 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.views.generic import View, FormView
|
from django.views.generic import View, FormView
|
||||||
from django.contrib.auth import authenticate, login, logout
|
from django.contrib.auth import authenticate, login, logout
|
||||||
|
from django.contrib.auth.models import User
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.core.validators import validate_email, ValidationError
|
from django.core.validators import validate_email, ValidationError
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||||
from django.core.mail import EmailMessage
|
from django.core.mail import EmailMessage
|
||||||
from django.views.decorators.cache import cache_control
|
from django.views.decorators.cache import cache_control
|
||||||
|
from rest_framework.views import APIView
|
||||||
|
from rest_framework.response import Response
|
||||||
from .models import ResetToken
|
from .models import ResetToken
|
||||||
from .forms import LoginForm
|
from .forms import LoginForm
|
||||||
from .ungleich_ldap import LdapManager
|
from .ungleich_ldap import LdapManager
|
||||||
|
@ -93,7 +96,25 @@ class Register(View):
|
||||||
return render(request, 'error.html', { 'urlname': urlname,
|
return render(request, 'error.html', { 'urlname': urlname,
|
||||||
'service': service,
|
'service': service,
|
||||||
'error': e } )
|
'error': e } )
|
||||||
|
# Finally, we send the send user credentials via email
|
||||||
|
creationtime = int(datetime.utcnow().timestamp())
|
||||||
|
# Construct the data for the email
|
||||||
|
email_from = settings.EMAIL_FROM_ADDRESS
|
||||||
|
to = ['%s <%s>' % (username, email)]
|
||||||
|
subject = '{}, Welcome to datacenterlight'.format(firstname)
|
||||||
|
body = 'The username {} was successfully created.\n'.format(username)
|
||||||
|
# Build the email
|
||||||
|
mail = EmailMessage(
|
||||||
|
subject=subject,
|
||||||
|
body=body,
|
||||||
|
from_email=email_from,
|
||||||
|
to=to
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
mail.send()
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
pass
|
||||||
return render(request, 'usercreated.html', { 'user': username } )
|
return render(request, 'usercreated.html', { 'user': username } )
|
||||||
|
|
||||||
class ChangeData(LoginRequiredMixin, View):
|
class ChangeData(LoginRequiredMixin, View):
|
||||||
|
@ -459,3 +480,57 @@ class PseudoUser():
|
||||||
# random alphanumeric strings for primary key and password, just used for token generation
|
# random alphanumeric strings for primary key and password, just used for token generation
|
||||||
pk = ''.join(choice(string.ascii_letters + string.digits) for _ in range(20))
|
pk = ''.join(choice(string.ascii_letters + string.digits) for _ in range(20))
|
||||||
password = ''.join(choice(string.ascii_letters + string.digits) for _ in range(30))
|
password = ''.join(choice(string.ascii_letters + string.digits) for _ in range(30))
|
||||||
|
|
||||||
|
class UserCreateAPI(APIView):
|
||||||
|
|
||||||
|
def post(self, request):
|
||||||
|
print(request.data)
|
||||||
|
print(request.POST)
|
||||||
|
|
||||||
|
username = request.POST.get('username')
|
||||||
|
email = request.POST.get('email')
|
||||||
|
firstname = request.POST.get('firstname')
|
||||||
|
lastname = request.POST.get('lastname')
|
||||||
|
|
||||||
|
if username == "" or not username:
|
||||||
|
return Response('Please supply a username.', 400)
|
||||||
|
try:
|
||||||
|
validate_email(email)
|
||||||
|
except ValidationError:
|
||||||
|
return Response('Email is not valid.', 400)
|
||||||
|
if not firstname or not lastname:
|
||||||
|
return Response('Please provide firstname and lastname', 400)
|
||||||
|
|
||||||
|
pwd = r'%s' % User.objects.make_random_password()
|
||||||
|
|
||||||
|
try:
|
||||||
|
ldap_manager = LdapManager()
|
||||||
|
ldap_manager.create_user(
|
||||||
|
username, pwd, firstname, lastname, email
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
return Response('While trying to create the user, an error was encountered: %s' % e, 400)
|
||||||
|
|
||||||
|
# send user credentials via email
|
||||||
|
creationtime = int(datetime.utcnow().timestamp())
|
||||||
|
# Construct the data for the email
|
||||||
|
email_from = settings.EMAIL_FROM_ADDRESS
|
||||||
|
to = ['%s <%s>' % (username, email)]
|
||||||
|
subject = 'Your datacenterlight credentials'
|
||||||
|
body = 'Your user was successfully created.\n'
|
||||||
|
body += 'Your credentials are:\n'
|
||||||
|
body += 'Username: %s\n\n' % username
|
||||||
|
body += 'Password: %s\n\n' % pwd
|
||||||
|
body += 'We strongly recommend you to after log in change your password.\n'
|
||||||
|
# Build the email
|
||||||
|
mail = EmailMessage(
|
||||||
|
subject=subject,
|
||||||
|
body=body,
|
||||||
|
from_email=email_from,
|
||||||
|
to=to
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
mail.send()
|
||||||
|
except:
|
||||||
|
return Response('User was created, but failed to send the email', 201)
|
||||||
|
return Response('User successfully created', 200)
|
||||||
|
|
|
@ -5,3 +5,4 @@ django-bootstrap3
|
||||||
django-filter==2.1.0
|
django-filter==2.1.0
|
||||||
python-decouple
|
python-decouple
|
||||||
ldap3
|
ldap3
|
||||||
|
djangorestframework
|
Loading…
Reference in a new issue