Skip to content

Commit

Permalink
setting up login and registration
Browse files Browse the repository at this point in the history
  • Loading branch information
ELMORABITYounes committed Aug 9, 2018
1 parent e3d0e85 commit b2c264f
Show file tree
Hide file tree
Showing 19 changed files with 833 additions and 170 deletions.
3 changes: 3 additions & 0 deletions .idea/ensak-project.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/symfony2.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

294 changes: 187 additions & 107 deletions .idea/workspace.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function registerBundles()
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Vich\UploaderBundle\VichUploaderBundle(),
];

if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
Expand Down
4 changes: 3 additions & 1 deletion app/Resources/translations/validators.fr.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Remember me: Se souvenir de moi
Password: Mot de passe
Username: Adresse émail
Username: Adresse émail
Email already taken: Email déja éxistant
Repeat Password: Confirmer le mot de passe
64 changes: 18 additions & 46 deletions app/Resources/views/Security/register.html.twig
Original file line number Diff line number Diff line change
@@ -1,77 +1,53 @@
{% extends 'base.html.twig' %}

{% block body%}
<div class="container content">
<div class="row">
<div class="card card-register mx-auto mt-5 col-md-8">
<div class="card-header">Register an Account</div>
<div class="card-body">
<form>
<div class="form-group">
<div class="form-row">
<div class="col-md-3">
<div>
<label>Vous etes :</label>
</div>
</div>
<div class="col-md-6">
<div class="form-check-inline">
<label class="form-check-label" for="radio1">
<input type="radio" class="form-check-input" id="radio1" name="optradio" value="option1" checked>Etudiant
</label>
</div>
<div class="form-check-inline">
<label class="form-check-label" for="radio2">
<input type="radio" class="form-check-input" id="radio2" name="optradio" value="option2">Professeur
</label>
</div>
</div>
</div>
</div>
{{ form_start(form) }}
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<label for="firstName">Prénom :</label>
<input type="text" id="firstName" class="form-control" placeholder="Entrez votre prénom" required="required" autofocus="autofocus">
{{ form_row(form.firstName) }}
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<label for="lastName">Nom :</label>
<input type="text" id="lastName" class="form-control" placeholder="Entrez votre nom" required="required">
{{ form_row(form.secondName) }}
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="form-label-group">
<label for="inputEmail">Email :</label>
<input type="email" id="inputEmail" class="form-control" placeholder="Entrez votre émail" required="required">
{{ form_row(form.email) }}
</div>
</div>
<div class="form-group">
<div class="form-label-group">
<label for="departement">Département :</label>
<select id="departement" class="custom-select">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
</select>
{% if form.departement is defined and form.departement is not null %}
{{ form_row(form.departement) }}
{% elseif form.filiere is defined and form.filiere is not null%}
{{ form_row(form.filiere) }}
{% endif %}
</div>
</div>
<div class="form-group">
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<label for="inputTel">Télephone(Optionnel) :</label>
<input type="text" id="inputTel" class="form-control" placeholder="+(212) 645 45 45 45" required="required" autofocus="autofocus">
{{ form_row(form.tel) }}
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<label for="inpudIdentity">CNE/Numero de somme :</label>
<input type="text" id="inpudIdentity" class="form-control" placeholder="CNE/Numero de somme" required="required">
{% if form.somme is defined and form.somme is not null %}
{{ form_row(form.somme) }}
{% elseif form.cne is defined and form.cne is not null%}
{{ form_row(form.cne) }}
{% endif %}
</div>
</div>
</div>
Expand All @@ -80,26 +56,22 @@
<div class="form-row">
<div class="col-md-6">
<div class="form-label-group">
<label for="inputPassword">Mot de passe :</label>
<input type="password" id="inputPassword" class="form-control" placeholder="Password" required="required">
{{ form_row(form.plainPassword.first) }}
</div>
</div>
<div class="col-md-6">
<div class="form-label-group">
<label for="inputPassword">Confirmer mot de passe :</label>
<input type="password" id="confirmPassword" class="form-control" placeholder="Confirmer le mot de passe" required="required">
{{ form_row(form.plainPassword.second) }}
</div>
</div>
</div>
</div>

<button class="btn btn-primary btn-block">Register</button>
</form>
{{ form_end(form) }}
<div class="text-center">
<a class="d-block medium" href="#">Forgot Password?</a>
</div>
</div>
</div>
</div>

{% endblock %}
17 changes: 13 additions & 4 deletions app/Resources/views/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,35 @@
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav text-uppercase ml-auto">
<li class="nav-item">
<a id="login" class="nav-link btn btn-primary btn-lg text-uppercase js-scroll-trigger" class="conn" href="{{ path('login') }}">Se connecter <i class="fa fa-lock"></i></a>
<a id="login" class="nav-link btn btn-primary btn-lg text-uppercase js-scroll-trigger conn" href="{{ path('login') }}">Se connecter <i class="fa fa-lock"></i></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
S'inscrire
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="{{ path('register') }}">Professeur</a>
<a class="dropdown-item" href="#">Etudiant</a>
<a class="dropdown-item" href="{{ path('app_registration', {'type': 'teacher'}) }}">Professeur</a>
<a class="dropdown-item" href="{{ path('app_registration', {'type': 'student'}) }}">Etudiant</a>
</div>
</li>

</ul>
</div>
</div>
</nav>
<div class="container content">
<div class="row">
{% for message in app.flashes('success') %}
<div class="col-md-6 offset-md-3 alert alert-success text-center">{{ message }}</div>
{% endfor %}

{% for message in app.flashes('error') %}
<div class="col-md-6 offset-md-3 alert alert-danger text-center">{{ message }}</div>
{% endfor %}

</div>

{% block body %}

{% endblock %}
</div>
<div id="push"></div>
Expand Down
8 changes: 7 additions & 1 deletion app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ imports:
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: fr
locale: en

framework:
#esi: ~
Expand Down Expand Up @@ -37,6 +37,8 @@ twig:
strict_variables: '%kernel.debug%'
form_themes:
- 'bootstrap_4_layout.html.twig'
globals:
fos_csrf_provider: "@security.csrf.token_manager"
# Doctrine Configuration
doctrine:
dbal:
Expand Down Expand Up @@ -70,3 +72,7 @@ swiftmailer:
sensio_framework_extra:
router:
annotations: false


vich_uploader:
db_driver: orm
2 changes: 1 addition & 1 deletion app/config/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ security:
default_target_path: /
always_use_default_target_path: true
failure_path: /login
csrf_token_generator: security.csrf.token_manager

# activate different ways to authenticate

# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"symfony/security-csrf": "^3.4",
"symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "3.4.*",
"twig/twig": "^1.0||^2.0"
"twig/twig": "^1.0||^2.0",
"vich/uploader-bundle": "^1.7"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
Expand Down
Loading

0 comments on commit b2c264f

Please sign in to comment.