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 +7 -0
- data/MIT-LICENSE +1 -1
- data/app/controllers/sessions_controller.rb +2 -1
- data/app/controllers/users_controller.rb +2 -1
- data/app/views/users/index.html.erb +1 -1
- data/lib/generators/tkh_authentication/create_or_update_locales/templates/fr.yml +11 -0
- data/lib/tasks/tkh_authentication_tasks.rake +1 -4
- data/lib/tkh_authentication/tkh_authentication_action_controller_extension.rb +8 -4
- data/lib/tkh_authentication/version.rb +1 -1
- metadata +4 -4
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
@@ -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
|
@@ -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 ?"
|
@@ -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
|
-
|
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
|
-
|
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
|
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.
|
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-
|
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: -
|
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: -
|
183
|
+
hash: -1846270554673356204
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
186
|
rubygems_version: 1.8.23
|