user_mgmt 0.9 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/user_mgmt/registrations_controller.rb +1 -4
- data/app/controllers/user_mgmt/sessions_controller.rb +5 -14
- data/app/helpers/user_mgmt/application_helper.rb +4 -4
- data/app/views/user_mgmt/sessions/new.html.haml +5 -1
- data/config/routes.rb +0 -1
- data/lib/user_mgmt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b6a52073104bb38a80617fef51aed42509807ff
|
4
|
+
data.tar.gz: bd959bd31fa90f1839b00a89bebab4f9e2e10f47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 945e71852a656ef95b080b396008548ed7b48905d0749b53d3c42776e7ebf5576ab8a1c227e99e02fc680bdde16ce35d00ce6c60125552bf46ba5fe6598439c0
|
7
|
+
data.tar.gz: e9c438b65fbdd00199ccca061bfa6f2ec17de9f4556dcc0387b460247b38a4c3e903ba5bd349871d3ba5fbeb07afb4cf3da81873ff6f14b604090d1f9d644169
|
@@ -15,7 +15,7 @@ module UserMgmt
|
|
15
15
|
|
16
16
|
if response[:status] == "200"
|
17
17
|
flash[:success] = "User was created succesfully!"
|
18
|
-
|
18
|
+
cookies.permanent[:user_session_id] = response[:body]["session"]
|
19
19
|
redirect_to main_app.root_path
|
20
20
|
else
|
21
21
|
flash[:error] = response[:body]
|
@@ -29,9 +29,6 @@ module UserMgmt
|
|
29
29
|
|
30
30
|
end
|
31
31
|
|
32
|
-
def add_strategy
|
33
|
-
end
|
34
|
-
|
35
32
|
def password_reset
|
36
33
|
end
|
37
34
|
|
@@ -17,7 +17,7 @@ module UserMgmt
|
|
17
17
|
|
18
18
|
if response[:status] == "200"
|
19
19
|
flash[:success] = "User logged in!"
|
20
|
-
|
20
|
+
cookies.permanent[:user_session_id] = response[:body]["session"]
|
21
21
|
redirect_to main_app.root_path
|
22
22
|
else
|
23
23
|
flash[:error] = response[:body]
|
@@ -41,23 +41,14 @@ module UserMgmt
|
|
41
41
|
@provider = "windows_live"
|
42
42
|
end
|
43
43
|
|
44
|
-
@umid = current_user["umid"] if user_logged_in?
|
45
|
-
|
46
44
|
response = log_in_oauth @uid, @provider
|
47
45
|
|
48
46
|
# if user logged in succesfully, just redirect to main page,
|
49
47
|
# otherwise it means the user doesn't exist yet, so continue
|
50
48
|
# normaly (user will be asked for his email).
|
51
49
|
if response[:status] == "200"
|
52
|
-
|
53
|
-
|
54
|
-
else
|
55
|
-
session.permanent[:user_session_id] = response[:body]["session"]
|
56
|
-
redirect_to main_app.root_path, flash: { success: "User logged in!" }
|
57
|
-
end
|
58
|
-
elsif @umid
|
59
|
-
add_strategy @uid, @provider, @umid, session[:user_session_id]
|
60
|
-
redirect_to main_app.root_path, flash: { success: "Strategy added successfully!" }
|
50
|
+
cookies.permanent[:user_session_id] = response[:body]["session"]
|
51
|
+
redirect_to main_app.root_path, flash: { success: "User logged in!" }
|
61
52
|
end
|
62
53
|
|
63
54
|
end
|
@@ -72,7 +63,7 @@ module UserMgmt
|
|
72
63
|
redirect_to sign_up_path, flash: { error: response[:body] }
|
73
64
|
else
|
74
65
|
response = log_in_oauth params["uid"], params["provider"].to_sym
|
75
|
-
|
66
|
+
cookies.permanent[:user_session_id] = response[:body]["session"]
|
76
67
|
redirect_to main_app.root_path, flash: { success: "User logged in!" }
|
77
68
|
end
|
78
69
|
|
@@ -80,7 +71,7 @@ module UserMgmt
|
|
80
71
|
|
81
72
|
# GET /user/log_out
|
82
73
|
def destroy
|
83
|
-
|
74
|
+
cookies.delete(:user_session_id)
|
84
75
|
redirect_to main_app.root_path, flash: { success: "Logged out!" }
|
85
76
|
end
|
86
77
|
|
@@ -2,18 +2,18 @@ module UserMgmt
|
|
2
2
|
module ApplicationHelper
|
3
3
|
|
4
4
|
def user_logged_in?
|
5
|
-
return false if
|
6
|
-
status = user_info(
|
5
|
+
return false if cookies[:user_session_id] == nil
|
6
|
+
status = user_info(cookies[:user_session_id])[:status]
|
7
7
|
if status == "200"
|
8
8
|
return true
|
9
9
|
else
|
10
|
-
|
10
|
+
cookies.delete(:user_session_id)
|
11
11
|
return false
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def current_user
|
16
|
-
@current_user ||= user_info(
|
16
|
+
@current_user ||= user_info(cookies[:user_session_id])[:body] unless cookies[:user_session_id] == nil
|
17
17
|
end
|
18
18
|
|
19
19
|
def sign_up email, password, password_confirmation, admin=false, host=UserMgmt.external_database_URI
|
@@ -24,4 +24,8 @@
|
|
24
24
|
= link_to image_tag('user_mgmt/normal/yahoo-copied.jpg', class: "menu_icon", height: '45', width: '45'), "auth/yahoo"
|
25
25
|
= link_to image_tag('user_mgmt/normal/gmail-copied.png', class: "menu_icon", height: '45', width: '45'), "auth/google_oauth2"
|
26
26
|
.password_reset
|
27
|
-
= link_to 'forgot your password?', password_reset_request_path
|
27
|
+
= link_to 'forgot your password?', password_reset_request_path
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
data/config/routes.rb
CHANGED
@@ -12,7 +12,6 @@ UserMgmt::Engine.routes.draw do
|
|
12
12
|
post '/send_password_reset' => 'registrations#send_password_reset', as: 'send_password_reset'
|
13
13
|
get '/password_reset_request' => 'registrations#password_reset_request', as: 'password_reset_request'
|
14
14
|
post '/send_reset_request' => 'registrations#send_reset_request', as: 'send_reset_request'
|
15
|
-
get '/add_strategy' => 'registrations#add_strategy', as: 'add_strategy'
|
16
15
|
|
17
16
|
get 'auth/:provider/callback' => 'sessions#oauth_email', as: 'oauth_email'
|
18
17
|
get 'auth/failure' => 'application#main_page', as: 'cancel'
|
data/lib/user_mgmt/version.rb
CHANGED