user_mgmt 0.9.1 → 0.9.1.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: 6b6a52073104bb38a80617fef51aed42509807ff
4
- data.tar.gz: bd959bd31fa90f1839b00a89bebab4f9e2e10f47
3
+ metadata.gz: c2fcb1d160ddace35d83ecbf4dfb6530ca3a0ddb
4
+ data.tar.gz: 346776791db5b53089be3d4e66b999cf1918ab2a
5
5
  SHA512:
6
- metadata.gz: 945e71852a656ef95b080b396008548ed7b48905d0749b53d3c42776e7ebf5576ab8a1c227e99e02fc680bdde16ce35d00ce6c60125552bf46ba5fe6598439c0
7
- data.tar.gz: e9c438b65fbdd00199ccca061bfa6f2ec17de9f4556dcc0387b460247b38a4c3e903ba5bd349871d3ba5fbeb07afb4cf3da81873ff6f14b604090d1f9d644169
6
+ metadata.gz: f7b68783c380219488e1c3659af4e729922cde2df68469dd4bc9289687f43173991a90ef46421457f7c86763ffb0b9cad84bbdd3586cf7adcac117dbf654f2b7
7
+ data.tar.gz: c35bc5a5d167ad7f81b3962f084223e8551a858cba38c500422230b63e4a066c46580121a64f1a7d834bb37f45ff1bc8ef951b0ad6800ab295f8589c705cbc2e
@@ -29,6 +29,9 @@ module UserMgmt
29
29
 
30
30
  end
31
31
 
32
+ def add_strategy
33
+ end
34
+
32
35
  def password_reset
33
36
  end
34
37
 
@@ -41,14 +41,23 @@ module UserMgmt
41
41
  @provider = "windows_live"
42
42
  end
43
43
 
44
+ @umid = current_user["umid"] if user_logged_in?
45
+
44
46
  response = log_in_oauth @uid, @provider
45
47
 
46
48
  # if user logged in succesfully, just redirect to main page,
47
49
  # otherwise it means the user doesn't exist yet, so continue
48
50
  # normaly (user will be asked for his email).
49
51
  if response[:status] == "200"
50
- cookies.permanent[:user_session_id] = response[:body]["session"]
51
- redirect_to main_app.root_path, flash: { success: "User logged in!" }
52
+ if @umid
53
+ redirect_to main_app.root_path, flash: { error: "User already signed up for the app!" }
54
+ else
55
+ cookies.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, cookies[:user_session_id]
60
+ redirect_to main_app.root_path, flash: { success: "Strategy added successfully!" }
52
61
  end
53
62
 
54
63
  end
@@ -24,8 +24,4 @@
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
28
-
29
-
30
-
31
-
27
+ = link_to 'forgot your password?', password_reset_request_path
data/config/routes.rb CHANGED
@@ -12,6 +12,7 @@ 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'
15
16
 
16
17
  get 'auth/:provider/callback' => 'sessions#oauth_email', as: 'oauth_email'
17
18
  get 'auth/failure' => 'application#main_page', as: 'cancel'
@@ -1,3 +1,3 @@
1
1
  module UserMgmt
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.1.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.1
4
+ version: 0.9.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Faria, Fernando Gorodscy, Josh Leslie