user_mgmt 0.8 → 0.8.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: e09f33639a5346ac20ee17b2963e8ea06bbc7cb5
4
- data.tar.gz: 7902d4fbd61aa35b0160cc12a7433e569811343d
3
+ metadata.gz: d86ce874e9fca5b3fbdbacd650223f1af7a58f64
4
+ data.tar.gz: f82377f7e78d3373a54b306e5dd5cfb168eea1c6
5
5
  SHA512:
6
- metadata.gz: 2c370c07aa397379b481f9b11d680c016a413ff3ea70b3362477bbb3939c6544123c6ee2bbcd1530a06c895e6c6ec03352ce8798636b38a835ac531b8e7cf31f
7
- data.tar.gz: f97bc98c7bedad4652daca48f6d59a00408e5490518257dff206f0a5e69d57337f37869704806a37093bb411c99a7359a8d0d7ec2fc7e272ea5d1308ff3ad1f4
6
+ metadata.gz: 3ab66aa8d4826c5fe1e479abb2142eb92f9d7656184617c681f0aac982c54e408d56797a323c7dec7bf182d42501ca91447290b8f4df15e0cafd21d666b1cfe8
7
+ data.tar.gz: 6d23c77649db0a08fd0b2762f35b5d26b152954454d90942dcadb6b44c2efabfe9b85303610ab0621c6351c10077fd946c21f17bdc79d6c6eb1f984e9e9edc60
@@ -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
@@ -1,3 +1,3 @@
1
1
  module UserMgmt
2
- VERSION = "0.8"
2
+ VERSION = "0.8.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_mgmt
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.8'
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Faria, Fernando Gorodscy, Josh Leslie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2013-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3