dailycred 0.1.31 → 0.1.32
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/sessions_controller.rb +3 -5
- data/dailycred.gemspec +1 -1
- data/lib/dailycred/helper.rb +7 -1
- metadata +1 -1
@@ -12,13 +12,11 @@ class SessionsController < ApplicationController
|
|
12
12
|
#GET /logout
|
13
13
|
def destroy
|
14
14
|
session[:user_id] = nil
|
15
|
-
|
15
|
+
redirect_to_unauth
|
16
16
|
end
|
17
17
|
|
18
|
-
def failure
|
19
|
-
|
20
|
-
path = !conf[:after_unauth].nil? ? conf[:after_unauth] : dailycred_engine.auth_info_path
|
21
|
-
redirect_to path, notice: params[:message]
|
18
|
+
def failure login
|
19
|
+
redirect_to_unauth, notice: params[:message]
|
22
20
|
end
|
23
21
|
|
24
22
|
def info
|
data/dailycred.gemspec
CHANGED
data/lib/dailycred/helper.rb
CHANGED
@@ -5,7 +5,7 @@ module Dailycred
|
|
5
5
|
# example:
|
6
6
|
# before_filter :authenticate
|
7
7
|
def authenticate
|
8
|
-
|
8
|
+
redirect_to_unauth unless current_user
|
9
9
|
end
|
10
10
|
|
11
11
|
# helper method for getting an instance of dailycred
|
@@ -34,6 +34,12 @@ module Dailycred
|
|
34
34
|
redirect_to path, opts
|
35
35
|
end
|
36
36
|
|
37
|
+
def redirect_to_unauth opts = {}
|
38
|
+
conf = Rails.configuration.DAILYCRED_OPTIONS
|
39
|
+
path = !conf[:after_unauth].nil? ? conf[:after_unauth] : dailycred_engine.auth_info_path
|
40
|
+
redirect_to path, opts
|
41
|
+
end
|
42
|
+
|
37
43
|
|
38
44
|
ActiveSupport.on_load(:action_controller) do
|
39
45
|
helper_method :current_user, :login_path, :set_state, :dailycred, :authenticate
|