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;
|
||||
}
|
||||
|
||||
.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) {
|
||||
.h1-thin {
|
||||
font-size: 27px;
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<title>ungleich</title>
|
||||
{% block title %}
|
||||
{% endblock %}
|
||||
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{% static 'datacenterlight/css/bootstrap-3.3.7.min.css' %}" rel="stylesheet">
|
||||
|
@ -47,14 +47,14 @@
|
|||
<!-- End Google Analytics -->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body style="overflow-x: hidden">
|
||||
<!-- cms_toolbar %}-->
|
||||
|
||||
{% block navbar %}
|
||||
{% include "includes/_navbar_transparent.html" %}
|
||||
{% 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 %}
|
||||
{% endblock %}
|
||||
</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>
|
||||
<br><br>
|
||||
<ul>
|
||||
<li> Username: {{user}} </li>
|
||||
<li> Firstname: {{firstname}} </li>
|
||||
<li> Lastname: {{lastname}} </li>
|
||||
<li> Email: {{email}} </li>
|
||||
</ul>
|
||||
<br><br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to indexpage">
|
||||
</form>
|
||||
{% block title %}
|
||||
<title> Success! </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 " 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>
|
||||
<br><br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to indexpage">
|
||||
</form>
|
||||
{% block title %}
|
||||
<title> Password Updated. </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">
|
||||
<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>
|
||||
<br><br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to indexpage">
|
||||
</form>
|
||||
<br><br>
|
||||
To change the password for {{user}}, please supply
|
||||
<form action={% url 'change_password' %} method="post">
|
||||
{% block title %}
|
||||
<title> Changing the password 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 " Password change " %}</h1>
|
||||
<form action="{% url 'change_password' %}" method="post" class="form" novalidated>
|
||||
{% csrf_token %}
|
||||
<br>The old password:<br>
|
||||
<input type="password" name="oldpassword" id="oldpassword">
|
||||
<br><br>The new password (at least 8 characters):<br>
|
||||
<input type="password" name="password1" id="password1">
|
||||
<br>Please repeat the new Password:<br>
|
||||
<input type="password" name="password2" id="password2">
|
||||
<br><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
<br>
|
||||
<div class="form-group">
|
||||
<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 %}
|
||||
|
||||
<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">
|
||||
{% 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 %}
|
||||
<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>
|
||||
<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 %}
|
||||
|
||||
|
|
|
@ -1,18 +1,39 @@
|
|||
<title> Deleting an Account </title>
|
||||
{% extends "base_short.html" %}
|
||||
{% load i18n staticfiles bootstrap3 %}
|
||||
|
||||
<h2> Deleting an Account </h2>
|
||||
<br><br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to indexpage">
|
||||
</form>
|
||||
<br><br>
|
||||
To delete an account, please type the username and password below:
|
||||
<form action={% url 'account_delete' %} method="post">
|
||||
{% block title %}
|
||||
<title> Deleting Account </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 " Enter your credentials to confirm " %}</h1>
|
||||
<form action="{% url 'account_delete' %}" method="post" class="form" novalidated>
|
||||
{% csrf_token %}
|
||||
<br><br>Username:<br>
|
||||
<input type="text" name="username" id="username">
|
||||
<br><br>Password:<br>
|
||||
<input type="password" name="password" id="password">
|
||||
<br><br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
<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>
|
||||
<br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to indexpage">
|
||||
</form>
|
||||
{% block title %}
|
||||
<title> Deleted user {{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 " 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 %}
|
||||
<footer>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="container">
|
||||
<div class="col-lg-12">
|
||||
<ul class="list-inline">
|
||||
</ul>
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{% extends "base_short.html" %}
|
||||
{% load i18n staticfiles bootstrap3 %}
|
||||
|
||||
{% block title %}
|
||||
<title>ungleich</title>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<div class="auth-container">
|
||||
|
@ -17,7 +21,7 @@
|
|||
{% endfor %}
|
||||
<p class="red">{{form.non_field_errors|striptags}}</p>
|
||||
<div class="text-center">
|
||||
<button type="submit" class="btn choice-btn">
|
||||
<button type="submit" class="btn choice-btn btn-block">
|
||||
{% trans "Log in" %}
|
||||
</button>
|
||||
</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>
|
||||
<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.
|
||||
<form action={% url 'register' %} method="get">
|
||||
<input type="submit" value="Register an user">
|
||||
</form>
|
||||
<br><br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to indexpage">
|
||||
</form>
|
||||
{% block title %}
|
||||
<title>Login failed!</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 " 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>
|
||||
<br><br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to indexpage">
|
||||
</form>
|
||||
{% extends "base_short.html" %}
|
||||
{% load i18n staticfiles bootstrap3 %}
|
||||
|
||||
{% block title %}
|
||||
<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>
|
||||
<br><br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to indexpage">
|
||||
</form>
|
||||
<br><br>
|
||||
To register yourself an user, please fill out the fields below:
|
||||
<br>
|
||||
<form action={% url 'register' %} method="post">
|
||||
{% block title %}
|
||||
<title> Register an user at ungleich </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 "Sign Up" %}</h1>
|
||||
{% include 'includes/_messages.html' %}
|
||||
<form action="{% url 'register' %}" method="post" class="form" novalidated>
|
||||
{% csrf_token %}
|
||||
<br>Username (alphanumeric):<br>
|
||||
<input type="text" name="username" id="username">
|
||||
<br>Password (at least 8 characters):<br>
|
||||
<input type="password" name="password1" id="password1">
|
||||
<br>Please confirm your Password:<br>
|
||||
<input type="password" name="password2" id="password2">
|
||||
<br>Firstname:<br>
|
||||
<input type="text" name="firstname" id="firstname">
|
||||
<br>Lastname:<br>
|
||||
<input type="text" name="lastname" id="lastname">
|
||||
<br>Emailaddress:<br>
|
||||
<input type="text" name="email" id="email">
|
||||
<br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
<div class="form-group">
|
||||
<label class="sr-only control-label" for="username">Username</label>
|
||||
<input type="text" name="username" class="form-control" placeholder="Username (alphanumeric)" title="" required="" id="username">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="sr-only control-label" for="password1">password1</label>
|
||||
<input type="password" name="password1" class="form-control" placeholder="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>
|
||||
<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>
|
||||
<br><br>
|
||||
To reset your password, please enter your username below. You will get an email with a link to change your password.
|
||||
<br><br>
|
||||
<form action={% url 'reset_password' %} method="post">
|
||||
{% block title %}
|
||||
<title> Password reset </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 " 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 %}
|
||||
Username:<br>
|
||||
<input type="text" name="user" id="user">
|
||||
<br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
<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>
|
||||
<br><br>
|
||||
<form action={% url 'reset' %} method="post">
|
||||
{% block title %}
|
||||
<title> Set new password 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 "Please set new password for {{user}} " %}</h1>
|
||||
{% include 'includes/_messages.html' %}
|
||||
<form action="{% url 'reset' %}" method="post" class="form">
|
||||
{% 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>
|
||||
<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}}">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
<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>
|
||||
<br><br>
|
||||
You will shortly get the confirmation email to confirm that you wish to reset the password for {{user}}.<br>
|
||||
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">
|
||||
</form>
|
||||
{% block title %}
|
||||
<title> Reset request processed and confirmation email sent </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 " 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>
|
||||
<br><br>
|
||||
<form action={% url 'index' %} method="get">
|
||||
<input type="submit" value="Back to Indexpage">
|
||||
</form>
|
||||
{% block title %}
|
||||
<title> User {{ user }} created. </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 " 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>
|
||||
<br><br>
|
||||
You have the following options:
|
||||
<br>
|
||||
<form action={% url 'change_data' %} method="get">
|
||||
<input type="submit" value="Change your userdata">
|
||||
</form>
|
||||
<br>
|
||||
<form action={% url 'change_password' %} method="get">
|
||||
<input type="submit" value="Change your password">
|
||||
</form>
|
||||
<br>
|
||||
<form action={% url 'reset_password' %} method="get">
|
||||
<input type="submit" value="Reset your password">
|
||||
</form>
|
||||
<br>
|
||||
<form action={% url 'account_delete' %} method="get">
|
||||
<input type="submit" value="Delete your account">
|
||||
</form>
|
||||
<form action={% url 'logout' %} method="get">
|
||||
<input type="submit" value="Logout">
|
||||
</form>
|
||||
{% block title %}
|
||||
<title>Options 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 "Welcome," %} {{user}}</h1><br><br>
|
||||
<form class="form">
|
||||
<a class="btn choice-btn btn-block" href="{% url 'change_data' %}" role="button">{% trans "Change your userdata" %}</a><br>
|
||||
<a class="btn choice-btn btn-block" href="{% url 'change_password' %}" role="button">Change your password</a><br>
|
||||
<a class="btn choicered-btn btn-block" href="{% url 'logout' %}" role="button">{% trans "Logout" %}</a><br><br>
|
||||
</form>
|
||||
<br>
|
||||
<hr>
|
||||
<div class="text-center">
|
||||
<a href="{% url 'account_delete' %}">Delete your account</a><br>
|
||||
</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
|
||||
|
||||
# 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 = [
|
||||
path('register/', Register.as_view(), name="register"),
|
||||
path('create/', UserCreateAPI.as_view(), name="create"),
|
||||
path('changedata/', ChangeData.as_view(), name="change_data"),
|
||||
path('resetpassword/', ResetPassword.as_view(), name="reset_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.views.generic import View, FormView
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
from django.contrib.auth.models import User
|
||||
from django.http import HttpResponse
|
||||
from django.core.validators import validate_email, ValidationError
|
||||
from django.urls import reverse_lazy
|
||||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||
from django.core.mail import EmailMessage
|
||||
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 .forms import LoginForm
|
||||
from .ungleich_ldap import LdapManager
|
||||
|
@ -93,7 +96,25 @@ class Register(View):
|
|||
return render(request, 'error.html', { 'urlname': urlname,
|
||||
'service': service,
|
||||
'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 } )
|
||||
|
||||
class ChangeData(LoginRequiredMixin, View):
|
||||
|
@ -459,3 +480,57 @@ class PseudoUser():
|
|||
# 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))
|
||||
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
|
||||
python-decouple
|
||||
ldap3
|
||||
djangorestframework
|
Loading…
Reference in a new issue