aboutsummaryrefslogtreecommitdiffstats
path: root/003-Authentification.md
blob: 3c07b58d6d3f8600e8354c3bb41ab2e7d6c066f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Authentification
================

On va utiliser la gem [Clearance](https://github.com/thoughtbot/clearance) pour
nous donner de l'authentification.


1. Ouvrez le `Gemfile` et ajoutez cette ligne :

		gem 'clearance'

2. Utilisez Bundler pour installer la gem :

		bundle install

3. Pour installer Clearance, faites :

		rails generate clearance:install

4. Lancez les migrations :

		rails db:migrate

5. Relancez le serveur Rails

4. Ajoutez cet HTML (copiƩ du README de Clearance) dans le `<body>` du
   `layouts/application.html.erb` :

		<% if signed_in? %>
			<%= current_user.email %>
			<%= button_to "Sign out", sign_out_path, method: :delete %>
		<% else %>
			<%= link_to "Sign in", sign_in_path %>
		<% end %>

4. Inscription et connexion sont maintenant possibles depuis l'interface web de
   l'application.