tkh_authentication 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
 
4
4
 
5
+
6
+ ## 0.0.6
7
+
8
+ * Redirect users to target page upon logging in if they had been interrupted by authenticate or authenticate_with_admin filters
9
+
10
+
11
+
5
12
  ## 0.0.5
6
13
 
7
14
  * Users controller has both an authenticate and an authenticate_with_admin before_filters
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2012 YOURNAME
1
+ Copyright 2012 | Ten Thousand Hours - Swami Atma
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -11,7 +11,8 @@ class SessionsController < ApplicationController
11
11
  else
12
12
  cookies[:auth_token] = user.auth_token
13
13
  end
14
- redirect_to root_url, notice: t('authentication.login_confirmation')
14
+ redirect_to (session[:target_page] || root_url), notice: t('authentication.login_confirmation')
15
+ session[:target_page] = nil
15
16
  else
16
17
  flash.now.alert = t('authentication.warning.email_or_password_invalid')
17
18
  render "new"
@@ -16,7 +16,8 @@ class UsersController < ApplicationController
16
16
  @user = User.new(params[:user])
17
17
  if @user.save
18
18
  cookies[:auth_token] = @user.auth_token
19
- redirect_to root_url, notice: t('authentication.signup_confirmation')
19
+ redirect_to session[:target_page] || root_url, notice: t('authentication.signup_confirmation')
20
+ session[:target_page] = nil
20
21
  else
21
22
  render "new"
22
23
  end
@@ -14,7 +14,7 @@
14
14
  <tr>
15
15
  <td><%= user.name %></td>
16
16
  <td><%= user.email %></td>
17
- <td><%= user.admin? ? 'YES' : 'no' %></td>
17
+ <td><%= user.admin? ? '' : 'X' %></td>
18
18
  </tr>
19
19
  <% end %>
20
20
  </tbody>
@@ -179,6 +179,17 @@ fr:
179
179
 
180
180
  # custom sections - the obove is provided by rails
181
181
  language_name: Français
182
+
183
+
184
+ activerecord:
185
+ attributes:
186
+ user:
187
+ first_name: "prénom"
188
+ last_name: "nom de famille"
189
+ email: "courriel"
190
+ password: 'mot de passe'
191
+ password_confirmation: 'confirmation de mot de passe'
192
+
182
193
  authentication:
183
194
  create_your_account: 'créez votre compte'
184
195
  forgot_password: "avez vous oublié votre mot de passe ?"
@@ -4,7 +4,4 @@ namespace :tkh_authentication do
4
4
  system 'rails g tkh_authentication:create_migration'
5
5
  system 'rails g tkh_authentication:create_or_update_locales'
6
6
  end
7
- end
8
-
9
-
10
-
7
+ end
@@ -1,8 +1,6 @@
1
1
  module TkhAuthenticationActionControllerExtension
2
2
  def self.included(base)
3
3
  base.send(:include, InstanceMethods)
4
- # base.before_filter :authenticate
5
- # base.after_filter :my_method_2
6
4
  end
7
5
 
8
6
  module InstanceMethods
@@ -11,11 +9,17 @@ module TkhAuthenticationActionControllerExtension
11
9
  end
12
10
 
13
11
  def authenticate
14
- redirect_to login_url, alert: t('authentication.warning.login_needed') if current_user.nil?
12
+ if current_user.nil?
13
+ session[:target_page] = request.url
14
+ redirect_to login_url, alert: t('authentication.warning.login_needed')
15
+ end
15
16
  end
16
17
 
17
18
  def authenticate_with_admin
18
- redirect_to root_url, alert: t('authentication.warning.restricted_access') unless current_user && current_user.admin?
19
+ unless current_user && current_user.admin?
20
+ session[:target_page] = request.url if session[:target_page].nil?
21
+ redirect_to root_url, alert: t('authentication.warning.restricted_access')
22
+ end
19
23
  end
20
24
  end
21
25
  end
@@ -1,3 +1,3 @@
1
1
  module TkhAuthentication
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkh_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-31 00:00:00.000000000 Z
12
+ date: 2012-08-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -171,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
171
171
  version: '0'
172
172
  segments:
173
173
  - 0
174
- hash: -197654925651461113
174
+ hash: -1846270554673356204
175
175
  required_rubygems_version: !ruby/object:Gem::Requirement
176
176
  none: false
177
177
  requirements:
@@ -180,7 +180,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
180
  version: '0'
181
181
  segments:
182
182
  - 0
183
- hash: -197654925651461113
183
+ hash: -1846270554673356204
184
184
  requirements: []
185
185
  rubyforge_project:
186
186
  rubygems_version: 1.8.23