user_mgmt 0.9 → 0.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ca7d16c042b6a54c82a91fc4c2d2a977dfdc53e
4
- data.tar.gz: 4e9f10788c72a332678ec63a46c720d703b5f44b
3
+ metadata.gz: 6b6a52073104bb38a80617fef51aed42509807ff
4
+ data.tar.gz: bd959bd31fa90f1839b00a89bebab4f9e2e10f47
5
5
  SHA512:
6
- metadata.gz: 6cd9e510930130724f60d3b9d99d6cabb66b9c913c0d388ff59a2c5c2cf46e3a4addb13b528561384dc5d334c109a1796005de99885f93639549b26065d940fa
7
- data.tar.gz: 3d8b888161ab62e3e467df83af26444d4d2b7280df31a6e4b89ad0037878c75d63e8802a735bb7560a43373b9a6f9399edf7aad38f0f0c368de4870e2f514aa2
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
- session.permanent[:user_session_id] = response[:body]["session"]
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
- session.permanent[:user_session_id] = response[:body]["session"]
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
- if @umid
53
- redirect_to main_app.root_path, flash: { error: "User already signed up for the app!" }
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
- session.permanent[:user_session_id] = response[:body]["session"]
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
- session.delete(:user_session_id)
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 session[:user_session_id] == nil
6
- status = user_info(session[:user_session_id])[:status]
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
- session.delete(:user_session_id)
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(session[:user_session_id])[:body] unless session[:user_session_id] == nil
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'
@@ -1,3 +1,3 @@
1
1
  module UserMgmt
2
- VERSION = "0.9"
2
+ VERSION = "0.9.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_mgmt
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Faria, Fernando Gorodscy, Josh Leslie