mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-21 19:18:22 +02:00
Log in in a modal
This commit is contained in:
@ -102,7 +102,9 @@
|
||||
<a class="nav-link" href="{% url "registration:signup" %}"><i class="fas fa-user-plus"></i> {% trans "Register" %}</a>
|
||||
</li>
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="{% url "login" %}"><i class="fas fa-sign-in-alt"></i> {% trans "Log in" %}</a>
|
||||
<a class="nav-link" href="#" data-toggle="modal" data-target="#loginModal">
|
||||
<i class="fas fa-sign-in-alt"></i> {% trans "Log in" %}
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item active">
|
||||
@ -159,6 +161,7 @@
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
{% include "registration/login_modal.html" %}
|
||||
{% if user.is_authenticated %}
|
||||
{% include "participation/create_team_modal.html" %}
|
||||
{% include "participation/join_team_modal.html" %}
|
||||
@ -168,6 +171,11 @@
|
||||
CSRF_TOKEN = "{{ csrf_token }}";
|
||||
|
||||
$(document).ready(function () {
|
||||
$('a[data-target="#loginModal"]').click(function() {
|
||||
let modalBody = $("#loginModal div.modal-body");
|
||||
if (!modalBody.html().trim())
|
||||
modalBody.load("{% url "login" %} #form-content")
|
||||
});
|
||||
$('a[data-target="#createTeamModal"]').click(function() {
|
||||
let modalBody = $("#createTeamModal div.modal-body");
|
||||
if (!modalBody.html().trim())
|
||||
|
27
templates/registration/login.html
Normal file
27
templates/registration/login.html
Normal file
@ -0,0 +1,27 @@
|
||||
{% extends "base.html" %}
|
||||
{% comment %}
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
{% endcomment %}
|
||||
{% load i18n crispy_forms_filters %}
|
||||
|
||||
{% block title %}{% trans "Log in" %}{% endblock %}
|
||||
{% block contenttitle %}<h1>{% trans "Log in" %}</h1>{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if user.is_authenticated %}
|
||||
<p class="errornote">
|
||||
{% blocktrans trimmed %}
|
||||
You are authenticated as {{ user }}, but are not authorized to
|
||||
access this page. Would you like to login to a different account?
|
||||
{% endblocktrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
<form method="post" id="login-form">
|
||||
<div id="form-content">
|
||||
{% csrf_token %}
|
||||
{{ form | crispy }}
|
||||
<a href="{% url 'password_reset' %}" class="badge badge-light">{% trans 'Forgotten your password or username?' %}</a>
|
||||
</div>
|
||||
<input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary">
|
||||
</form>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user