mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-16 05:14:35 +02:00
Added user entity and basic login/logout system.
This commit is contained in:
parent
71711bc0ba
commit
62d875d1e5
8 changed files with 925 additions and 191 deletions
|
@ -81,16 +81,16 @@
|
|||
<ul class="navbar-nav ml-3">
|
||||
<li class="nav-item dropdown">
|
||||
<a href="#" class="dropdown-toggle link-anchor nav-link" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
||||
{% if true %}<i class="fa fa-user" aria-hidden="true"></i>{% else %}<i class="far fa-user" aria-hidden="true"></i>{% endif %} <span class="caret"></span></a>
|
||||
{% if app.user %}<i class="fa fa-user" aria-hidden="true"></i>{% else %}<i class="far fa-user" aria-hidden="true"></i>{% endif %} <span class="caret"></span></a>
|
||||
<ul class="dropdown-menu dropdown-menu-right" id="login-menu">
|
||||
{% if true %}
|
||||
<a class="dropdown-item disabled" href="#" >{% trans %}user.loggedin.label{% endtrans %} {$firstname} {$lastname} ({$username})</a>
|
||||
{% if app.user %}
|
||||
<a class="dropdown-item disabled" href="#" >{% trans %}user.loggedin.label{% endtrans %} {{ app.user.firstName }} {{app.user.lastName}} ({{app.user.name}})</a>
|
||||
<a class="dropdown-item" href="user_settings.php"><i class="fa fa-cogs fa-fw" aria-hidden="true"></i> {% trans %}user.settings.label{% endtrans %}</a>
|
||||
<a class="dropdown-item" href="user_info.php"><i class="fa fa-info-circle fa-fw" aria-hidden="true"></i> {% trans %}user.info.label{% endtrans %}</a>
|
||||
<li role="separator" class="dropdown-divider"></li>
|
||||
<a class="dropdown-item" href="{$relative_path}login.php?logout"><i class="fa fa-sign-out-alt fa-fw" aria-hidden="true"></i> {% trans %}user.logout{% endtrans %}</a>
|
||||
<a class="dropdown-item" href="{{ path('logout') }}"><i class="fa fa-sign-out-alt fa-fw" aria-hidden="true"></i> {% trans %}user.logout{% endtrans %}</a>
|
||||
{% else %}
|
||||
<a class="dropdown-item" href="{$relative_path}login.php?redirect={$smarty.server.REQUEST_URI|escape:"url"}" id="login-link"><i class="fa fa-sign-in-alt fa-fw" aria-hidden="true"></i> {% trans %}user.login{% endtrans %}</a>
|
||||
<a class="dropdown-item" href="{{ path('login', {'_target_path':app.request.pathinfo}) }}" id="login-link"><i class="fa fa-sign-in-alt fa-fw" aria-hidden="true"></i> {% trans %}user.login{% endtrans %}</a>
|
||||
{% endif %}
|
||||
<li role="separator" class="dropdown-divider"></li>
|
||||
<a class="dropdown-item disabled" href="#">{% trans %}user.language_select{% endtrans %}</a>
|
||||
|
|
51
templates/security/login.html.twig
Normal file
51
templates/security/login.html.twig
Normal file
|
@ -0,0 +1,51 @@
|
|||
{% extends "main_card.html.twig" %}
|
||||
|
||||
{% block title %}{% trans %}login.title{% endtrans %}{% endblock %}
|
||||
|
||||
{% block card_title %}<h5>
|
||||
<i class="fa fa-sign-in-alt fa-fw" aria-hidden="true"></i>
|
||||
{% trans %}login.card_title{% endtrans %}
|
||||
</h5>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if error %}
|
||||
<div class="alert alert-danger" role="alert">
|
||||
<strong>{{ error.messageKey|trans(error.messageData, 'security') }}</strong>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ parent() }}
|
||||
{% endblock %}
|
||||
|
||||
{% block card_content %}
|
||||
<form action="{{ path('login') }}" method="post" class="form-hor">
|
||||
|
||||
<input type="hidden" name="_csrf_token"
|
||||
value="{{ csrf_token('authenticate') }}">
|
||||
|
||||
<input type="hidden" name="_target_path" value="{{ app.request.query.get('_target_path') }}" />
|
||||
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-3 col-lg-2">{% trans %}login.username.label{% endtrans %}</label>
|
||||
<div class="col-md-9 col-lg-10">
|
||||
<input type="text" class="form-control" name="_username" value="{{ last_username }}"
|
||||
placeholder="{% trans %}login.username.placeholder{% endtrans %}" autocomplete="username">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label class="col-form-label col-md-3 col-lg-2">{% trans %}login.password.label{% endtrans %}</label>
|
||||
<div class="col-md-9 col-lg-10">
|
||||
<input type="password" class="form-control" placeholder="{% trans %}login.password.placeholder{% endtrans %}" name="_password"
|
||||
autocomplete="current-password">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<div class="col-md-9 offset-md-3 col-lg-10 offset-lg-2">
|
||||
<button type="submit" class="btn btn-primary">{% trans %}login.btn{% endtrans %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue