user_authentication 0.1.3 → 0.1.4
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cab4b717fa05399b7c8bccd19fd3e9b20803ff0
|
4
|
+
data.tar.gz: 225aa6d85665d2e2c70233b0f1c2bb486961e289
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d012c397a7afde1c31d821c53502ca50054272576ef8a59341a94a08d878c428d0684a2b0220e8bbc6f1fb8470e1b24ddc09a6a2f96677d48b828ae010f7672
|
7
|
+
data.tar.gz: 0d9dc1a12b89d5fda9932bc482632e3436f585344c1680348a4fdc24bf5a8c2aeceb0fffb2842570f87712f824af9d5ffb43d9353b70f70b340d6de7b7f02e3a
|
@@ -1,9 +1,10 @@
|
|
1
1
|
class ApplicationController < ActionController::Base
|
2
2
|
before_filter :set_current_user
|
3
3
|
|
4
|
-
|
4
|
+
# private
|
5
5
|
|
6
|
-
|
6
|
+
# redirect: Path to login page.
|
7
|
+
def authorize(redirect=nil)
|
7
8
|
# Not using skip_before_filter, since main app could inadvertently override that
|
8
9
|
# by using a before_filter :authorize in its application_controller.
|
9
10
|
if params[:controller] == "users" && ["login", "logout", "signup"].include?(params[:action])
|
@@ -11,8 +12,10 @@ class ApplicationController < ActionController::Base
|
|
11
12
|
end
|
12
13
|
|
13
14
|
if current_user.nil?
|
14
|
-
session[:
|
15
|
-
redirect_to
|
15
|
+
session[:redirect] = url_for params
|
16
|
+
redirect_to redirect || login_path, alert: "Please log in to access this page."
|
17
|
+
else
|
18
|
+
return true
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
@@ -29,6 +32,11 @@ class ApplicationController < ActionController::Base
|
|
29
32
|
|
30
33
|
true
|
31
34
|
end
|
35
|
+
|
36
|
+
def redirect
|
37
|
+
session_redirect = session.delete(:redirect)
|
38
|
+
redirect_to params[:redirect] || session_redirect || :back
|
39
|
+
end
|
32
40
|
end
|
33
41
|
|
34
42
|
require File.join Rails.root, "app/controllers/application_controller"
|
@@ -16,10 +16,10 @@ class UsersController < ApplicationController
|
|
16
16
|
if respond_to? :on_login
|
17
17
|
on_login
|
18
18
|
else
|
19
|
-
|
19
|
+
redirect
|
20
20
|
end
|
21
21
|
else
|
22
|
-
redirect_to :back, alert:
|
22
|
+
redirect_to :back, alert: "Please check email and password."
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -30,7 +30,7 @@ class UsersController < ApplicationController
|
|
30
30
|
if respond_to? :on_logout
|
31
31
|
on_logout
|
32
32
|
else
|
33
|
-
redirect_to
|
33
|
+
redirect_to :back
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -46,10 +46,10 @@ class UsersController < ApplicationController
|
|
46
46
|
if respond_to? :on_signup
|
47
47
|
on_signup
|
48
48
|
else
|
49
|
-
|
49
|
+
redirect
|
50
50
|
end
|
51
51
|
else
|
52
|
-
redirect_to :back, alert:
|
52
|
+
redirect_to :back, alert: "Please check email and password."
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -60,7 +60,7 @@ class UsersController < ApplicationController
|
|
60
60
|
if respond_to? :on_set_password
|
61
61
|
on_set_password
|
62
62
|
else
|
63
|
-
|
63
|
+
redirect
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: user_authentication
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sujoy Gupta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -171,6 +171,7 @@ files:
|
|
171
171
|
- lib/random.rb
|
172
172
|
- lib/tasks/user_authentication_tasks.rake
|
173
173
|
- lib/user_authentication/version.rb
|
174
|
+
- lib/user_authentication/version.rb~
|
174
175
|
- lib/user_authentication.rb
|
175
176
|
- MIT-LICENSE
|
176
177
|
- Rakefile
|