update login view
This commit is contained in:
6
fet2020/authentications/forms.py
Normal file
6
fet2020/authentications/forms.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django import forms
|
||||
|
||||
|
||||
class LoginForm(forms.Form):
|
||||
username = forms.CharField()
|
||||
password = forms.CharField(label='Passwort', widget=forms.PasswordInput())
|
||||
@@ -3,9 +3,11 @@ from django.contrib.auth import login, logout
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from documents.etherpadlib import del_ep_cookie
|
||||
|
||||
from .authentications import authentication
|
||||
from .decorators import unauthenticated_user, authenticated_user
|
||||
from documents.etherpadlib import del_ep_cookie
|
||||
from .forms import LoginForm
|
||||
|
||||
|
||||
@unauthenticated_user
|
||||
@@ -27,7 +29,11 @@ def loginPage(request):
|
||||
else:
|
||||
messages.info(request, 'username or password is incorrect')
|
||||
|
||||
context = {}
|
||||
form = LoginForm()
|
||||
|
||||
context = {
|
||||
"form": form,
|
||||
}
|
||||
return render(request, 'authentications/login.html', context)
|
||||
|
||||
|
||||
|
||||
@@ -1,123 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
|
||||
{% extends 'layout.html' %}
|
||||
{% block content %}
|
||||
|
||||
<div class="grid-container">
|
||||
<div class="grid-x">
|
||||
|
||||
<style>
|
||||
body,
|
||||
html {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
background: #7abecc !important;
|
||||
}
|
||||
.user_card {
|
||||
width: 350px;
|
||||
margin-top: auto;
|
||||
margin-bottom: auto;
|
||||
background: #74cfbf;
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
padding: 10px;
|
||||
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
-moz-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
|
||||
border-radius: 5px;
|
||||
<form action="" method="post">
|
||||
<h3>Anmeldung für FET-Mitarbeiter</h3>
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<input type="submit" class="button" name="btn_input" value="Anmelden">
|
||||
|
||||
}
|
||||
{% for message in messages %}
|
||||
<p id="messages">{{message}}</p>
|
||||
{% endfor %}
|
||||
|
||||
.form_container {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</form>
|
||||
|
||||
#form-title{
|
||||
color: #fff;
|
||||
|
||||
}
|
||||
</div>
|
||||
|
||||
.login_btn {
|
||||
width: 100%;
|
||||
background: #33ccff !important;
|
||||
color: white !important;
|
||||
}
|
||||
.login_btn:focus {
|
||||
box-shadow: none !important;
|
||||
outline: 0px !important;
|
||||
}
|
||||
.login_container {
|
||||
padding: 0 2rem;
|
||||
}
|
||||
.input-group-text {
|
||||
background: #f7ba5b !important;
|
||||
color: white !important;
|
||||
border: 0 !important;
|
||||
border-radius: 0.25rem 0 0 0.25rem !important;
|
||||
}
|
||||
.input_user,
|
||||
.input_pass:focus {
|
||||
box-shadow: none !important;
|
||||
outline: 0px !important;
|
||||
}
|
||||
</div>
|
||||
|
||||
#messages{
|
||||
background-color: grey;
|
||||
color: #fff;
|
||||
padding: 10px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="container h-100">
|
||||
<div class="d-flex justify-content-center h-100">
|
||||
<div class="user_card">
|
||||
<div class="d-flex justify-content-center">
|
||||
|
||||
|
||||
<h3 id="form-title">LOGIN</h3>
|
||||
</div>
|
||||
<div class="d-flex justify-content-center form_container">
|
||||
<form method="POST" action="">
|
||||
{% csrf_token %}
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fas fa-user"></i></span>
|
||||
</div>
|
||||
|
||||
<input type="text" name="username" placeholder="Username..." class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-2">
|
||||
<div class="input-group-append">
|
||||
<span class="input-group-text"><i class="fas fa-key"></i></span>
|
||||
</div>
|
||||
|
||||
<input type="password" name="password" placeholder="Password..." class="form-control" >
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-center mt-3 login_container">
|
||||
<input class="btn login_btn" type="submit" value="Login">
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
{% for message in messages %}
|
||||
<p id="messages">{{message}}</p>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user