aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorAlban Peignier2012-04-13 17:44:39 +0200
committerAlban Peignier2012-04-13 17:44:39 +0200
commitfbedb1806047513455f0c54c71e841e3c6a1d623 (patch)
treeff9ba58c3297f906176cbbae46fc885f97fd8997 /app
parent32800f1b63dc19598d171a2fa3a8df7994705d29 (diff)
downloadchouette-core-fbedb1806047513455f0c54c71e841e3c6a1d623.tar.bz2
First devise integration. Refs #7
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/models/user.rb9
-rw-r--r--app/views/layouts/_user_links.erb8
3 files changed, 18 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 7050568de..ae953a25a 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,4 +1,4 @@
class ApplicationController < ActionController::Base
protect_from_forgery
-
+ before_filter :authenticate_user!
end
diff --git a/app/models/user.rb b/app/models/user.rb
new file mode 100644
index 000000000..b2f7c8ec9
--- /dev/null
+++ b/app/models/user.rb
@@ -0,0 +1,9 @@
+class User < ActiveRecord::Base
+ # Include default devise modules. Others available are:
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :trackable, :validatable
+
+ # Setup accessible (or protected) attributes for your model
+ attr_accessible :email, :password, :password_confirmation, :remember_me
+end
diff --git a/app/views/layouts/_user_links.erb b/app/views/layouts/_user_links.erb
index 41d01375c..f82d4d7b4 100644
--- a/app/views/layouts/_user_links.erb
+++ b/app/views/layouts/_user_links.erb
@@ -1,5 +1,13 @@
<ul class="user">
<li class="home"><%= link_to t('layouts.home'), root_path %></li>
+
+ <% if user_signed_in? %>
+ <li> | </li>
+ <li><%= link_to t('layouts.user.profile'), edit_user_registration_path %></li>
+ <li> | </li>
+ <li><%= link_to t('layouts.user.sign_out'), destroy_user_session_path, :method => :delete %></li>
+ <% end %>
+
<li> | </li>
<li class="<%= language_class("fr") %>"><%= link_to_language :fr %></li>
<li class="<%= language_class("en") %>"><%= link_to_language :en %></li>