Commit 9d36043b authored by Christophe Henry's avatar Christophe Henry

feat: design on login page

parent dddd0b2a
Pipeline #6155 passed with stage
in 28 seconds
import validators
from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.validators import validate_email
from django.contrib.auth.models import AbstractUser
from django.db import models
from importlib import import_module
......@@ -29,6 +29,7 @@ s_fields = []
s_fields.extend(user_fields)
s_fields.extend(user_nested_fields)
class LDPUser(AbstractUser, Model):
slug = models.SlugField(unique=True, blank=True, null=True)
......@@ -36,12 +37,11 @@ class LDPUser(AbstractUser, Model):
verbose_name = _('user')
verbose_name_plural = _('users')
rdf_type = 'foaf:user'
owner_field = 'id'
lookup_field = 'slug'
container_path = 'users'
owner_field = 'urlid'
permission_classes=getattr(settings, 'USER_PERMISSION_CLASSES', [LDPPermissions])
nested_fields=user_nested_fields
permission_classes = getattr(settings, 'USER_PERMISSION_CLASSES', [LDPPermissions])
nested_fields = user_nested_fields
serializer_fields = s_fields
anonymous_perms = getattr(settings, 'USER_ANONYMOUS_PERMISSIONS', ['view'])
authenticated_perms = getattr(settings, 'USER_AUTHENTICATED_PERMISSIONS', ['inherit'])
......
#content {
display: grid;
align-items: center;
justify-items: center;
}
#content .sib-login-title {
max-width: 800px;
}
#content .sib-login-forms {
max-width: 500px;
padding: 2rem;
border: 1px solid gray;
border-radius: 0.5rem;
}
hr.separator {
border: 0;
height: 1px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), gray, rgba(0, 0, 0, 0));
}
#content .sib-login-forms .error {
color: red;
padding: 0;
margin: 0 0 2rem 0;
}
#content .sib-btn-link {
color: #80BCFF;
font-weight: bold;
padding: 1rem;
margin: 0;
text-decoration: none;
transition: color 0.5s;
}
#content .sib-btn-link:hover {
color: #99C9FF;
text-decoration: underline;
transition: color 0.5s;
}
#content .sib-login-forms .sib-form-table {
display: flex;
align-self: center;
}
#content .sib-login-form {
display: flex;
flex-direction: column;
}
#content .sib-validate {
margin-left: 0;
margin-right: 0;
}
\ No newline at end of file
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% block content %}
{% block title %}
{% trans "Login" %}
{% endblock %}
{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}
{% block supplementary_css %}
<link rel="stylesheet" href="{% static 'base.css' %}"/>
<link rel="stylesheet" href="{% static 'registration/login.css' %}"/>
{% endblock %}
{% if next %}
{% if user.is_authenticated %}
<p>Your account doesn't have access to this page. To proceed,
please login with an account that has access.</p>
{% else %}
<p>Please login TEST to see this page.</p>
{% block content %}
{% if next %}
<div class="sib-login-title">
{% if user.is_authenticated %}
<h2>
{% blocktrans %}
Your account doesn't have access to this page. To proceed,
please login with an account that has access.
{% endblocktrans %}
</h2>
{% else %}
<h2>{% trans "Please login to see this page." %}</h2>
{% endif %}
</div>
{% endif %}
{% endif %}
<form method="post" action="{% url 'login' %}">
{% csrf_token %}
<table>
<tr>
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
{# Assumes you setup the password_reset view in your URLconf #}
<p><a href="{% url 'password_reset' %}">Lost password?</a></p>
<p> or login using another authentification provider</p>
<form method="post" action="{% url 'oidc_login' %}">
{% csrf_token %}
<table>
<tr>
<td><label for="id_subject">email, web-id, or provider url:</label></td>
<td><input type="text" name="subject" required id="id_subject"/></td>
</tr>
</table>
<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>
<div class="sib-login-forms">
{% if form.errors %}
<p class="error">{% trans "Your username and password didn't match. Please try again." %}</p>
{% endif %}
<form class="sib-login-form" method="post" action="{% url 'login' %}">
{% csrf_token %}
<table class="sib-form-table">
<tr>
<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>
</tr>
<tr>
<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>
</tr>
</table>
<input class="sib-validate" type="submit" value="{% trans 'login' %}"/>
<input type="hidden" name="next" value="{{ next }}"/>
</form>
<a class="sib-btn-link" href="{% url 'password_reset' %}">{% trans "Lost password?" %}</a>
<hr class="separator"/>
<p>{% trans "or login using another authentification provider" %}</p>
<form class="sib-login-form" method="post" action="{% url 'oidc_login' %}">
{% csrf_token %}
<table class="sib-form-table">
<tr>
<td><label for="id_subject">{% trans "email, web-id, or provider url:" %}</label></td>
<td><input type="text" name="subject" required id="id_subject"/></td>
</tr>
</table>
<input class="sib-validate" type="submit" value="{% trans 'login' %}"/>
<input type="hidden" name="next" value="{{ next }}"/>
</form>
</div>
{% endblock %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment