added user management system
This commit is contained in:
parent
0b31a83f83
commit
8e855e0748
16 changed files with 446 additions and 3 deletions
55
invsystem/user_manager/templates/bases/navbar.html
Normal file
55
invsystem/user_manager/templates/bases/navbar.html
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
{% load static %}
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'user_manager/style.css' %}">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<link rel="shortcut icon" type="image/png" href="{% static 'user_manager/images' %}/favicon.ico"/>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/all.css"
|
||||
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Dosis" rel="stylesheet">
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-inverse">
|
||||
<div class="container-fluid">
|
||||
{% if user.is_authenticated %}
|
||||
<div class="navbar-header">
|
||||
|
||||
<img src="{% static 'user_manager/images/logo_50_50.png' %}" class="logo">
|
||||
|
||||
</div>
|
||||
<span class="welcome">Welcome {{ user.username }}!</span>
|
||||
{% else %}
|
||||
<div class="navbar-header">
|
||||
<img src="{% static 'user_manager/images/logo_50_50.png' %}" class="logo_not_logged_in">
|
||||
</div>
|
||||
{% endif %}
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="{% url 'index' %}">Home</a></li>
|
||||
{% if user.is_authenticated %}
|
||||
{% else %}
|
||||
<li><a href="#">Page 2</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% if user.is_authenticated %}
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="{% url 'logout' %}"><span class="glyphicon glyphicon-log-out"></span> Log out</a></li>
|
||||
<li><a href="#"><span class="glyphicon glyphicon-cog"></span> Settings</a></li>
|
||||
</ul>
|
||||
{% else %}
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="{% url 'register' %}"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
|
||||
<li><a href="{% url 'login' %}"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{% extends 'bases/navbar.html' %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<p>Logged out!</p>
|
||||
<a href="{% url 'login'%}">Click here to login again.</a>
|
||||
</div>
|
||||
</body>
|
||||
{% endblock %}
|
||||
|
||||
</html>
|
||||
|
||||
|
||||
50
invsystem/user_manager/templates/registration/login.html
Normal file
50
invsystem/user_manager/templates/registration/login.html
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{% extends 'bases/navbar.html' %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
{% block content %}
|
||||
<html>
|
||||
|
||||
|
||||
<div class="container">
|
||||
{% if form.errors %}
|
||||
<p class="error">Wrong username/password combination</p>
|
||||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
<p class="error">You cannot access that page without being logged in.</p>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<form class="form-horizontal login-form" action="{% url 'login' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="email">Username:</label>
|
||||
<div class="col-sm-10">
|
||||
{{ form.username }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="pwd">Password:</label>
|
||||
<div class="col-sm-10">
|
||||
{{ form.password }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-default">Login</button>
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
<span class="reset"><a href="{% url 'password_reset' %}">Lost password?</a></span>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
{% endblock %}
|
||||
25
invsystem/user_manager/templates/registration/register.html
Normal file
25
invsystem/user_manager/templates/registration/register.html
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{% extends 'bases/navbar.html' %}
|
||||
{% load static %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<html>
|
||||
|
||||
<div class="container">
|
||||
<h1>registration page</h1>
|
||||
<form method="post" action="{% url 'register' %}">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.errors %}
|
||||
<p>There are errors in the form</p>
|
||||
{% endif %}
|
||||
|
||||
{{ form }}
|
||||
<input type="submit" value="Register">
|
||||
</form>
|
||||
<div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
{% endblock %}
|
||||
13
invsystem/user_manager/templates/user_manager/index.html
Normal file
13
invsystem/user_manager/templates/user_manager/index.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{% extends 'bases/navbar.html' %}
|
||||
<html>
|
||||
{% block content%}
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h3>Right Aligned Navbar</h3>
|
||||
<p>The .navbar-right class is used to right-align navigation bar buttons.</p>
|
||||
</div>
|
||||
</body>
|
||||
{% endblock %}
|
||||
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue