challah 1.3.0 → 1.3.1
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 +4 -4
- data/VERSION +1 -1
- data/app/controllers/sessions_controller.rb +41 -40
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23bb94be0e8ab6875dc31cab8fcface51e966048
|
4
|
+
data.tar.gz: f57cf4b2de757c7d23fe36b586b6c7ba8db29e65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e79dc0f8f687cb192b2d055f9b448998d72228cc11d95ba8a907e6559a49519305fd5a0f86896a362d77a9eae6b02edee80077b6e2386fb20c52440d7c277f8c
|
7
|
+
data.tar.gz: 3f6ec00c9875e628e03b057bd5b5952275b5541c46a4bf8825abdba02bc4e6fbf018bcef0f1da71e4bce61e20adb5284b9a7214a07b0b85770a052aec6f1b524
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.1
|
@@ -1,50 +1,51 @@
|
|
1
|
-
if
|
2
|
-
|
3
|
-
|
4
|
-
# Rails >= 4.0
|
5
|
-
before_action :destroy_session, except: :create
|
6
|
-
else
|
7
|
-
# Rails <= 3.2
|
8
|
-
before_filter :destroy_session, except: :create
|
9
|
-
end
|
1
|
+
if File.exist?(Rails.root.join("controllers/application_controller"))
|
2
|
+
require "application_controller"
|
3
|
+
end
|
10
4
|
|
11
|
-
|
5
|
+
class SessionsController < (defined?(ApplicationController) ? ApplicationController : ActionController::Base)
|
6
|
+
if respond_to?(:before_action)
|
7
|
+
# Rails >= 4.0
|
8
|
+
before_action :destroy_session, except: :create
|
9
|
+
else
|
10
|
+
# Rails <= 3.2
|
11
|
+
before_filter :destroy_session, except: :create
|
12
|
+
end
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
# GET /login
|
15
|
+
# GET /sign-in
|
16
|
+
def new
|
17
|
+
@session = Challah::Session.new(request)
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
if @session.save
|
26
|
-
redirect_to return_to_path
|
27
|
-
else
|
28
|
-
redirect_to signin_path, alert: I18n.translate('sessions.create.failed_login')
|
29
|
-
end
|
30
|
-
end
|
20
|
+
# POST /login
|
21
|
+
# POST /sign-in
|
22
|
+
def create
|
23
|
+
@session = Challah::Session.new(request, params[:session])
|
24
|
+
@session.ip = request.remote_ip
|
31
25
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
redirect_to signin_path
|
26
|
+
if @session.save
|
27
|
+
redirect_to return_to_path
|
28
|
+
else
|
29
|
+
redirect_to signin_path, alert: I18n.translate('sessions.create.failed_login')
|
36
30
|
end
|
31
|
+
end
|
37
32
|
|
38
|
-
|
33
|
+
# GET /logout
|
34
|
+
# GET /sign-out
|
35
|
+
def destroy
|
36
|
+
redirect_to signin_path
|
37
|
+
end
|
39
38
|
|
40
|
-
|
41
|
-
current_user_session.destroy
|
42
|
-
end
|
39
|
+
protected
|
43
40
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
def destroy_session
|
42
|
+
current_user_session.destroy
|
43
|
+
end
|
44
|
+
|
45
|
+
def return_to_path(default_path = '/')
|
46
|
+
result = session[:return_to]
|
47
|
+
result = nil if result and result == "http://#{request.domain}/"
|
48
|
+
result || default_path
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: challah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Tornow
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: highline
|
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
193
193
|
version: '0'
|
194
194
|
requirements: []
|
195
195
|
rubyforge_project:
|
196
|
-
rubygems_version: 2.
|
196
|
+
rubygems_version: 2.2.2
|
197
197
|
signing_key:
|
198
198
|
specification_version: 4
|
199
199
|
summary: Rails authentication and sessions
|