Merge lp:~mardy/account-plugins/no-duplicates-1468599 into lp:account-plugins

Proposed by Alberto Mardegan
Status: Merged
Approved by: David Barth
Approved revision: 154
Merged at revision: 154
Proposed branch: lp:~mardy/account-plugins/no-duplicates-1468599
Merge into: lp:account-plugins
Diff against target: 78 lines (+18/-16)
2 files modified
qml/facebook/Main.qml (+14/-10)
qml/google/Main.qml (+4/-6)
To merge this branch: bzr merge lp:~mardy/account-plugins/no-duplicates-1468599
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Online Accounts Pending
Review via email: mp+283620@code.launchpad.net

Commit message

Use the new methods to retrieve the username.

Description of the change

Use the new methods to retrieve the username.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/facebook/Main.qml'
--- qml/facebook/Main.qml 2015-04-10 05:37:48 +0000
+++ qml/facebook/Main.qml 2016-01-22 15:00:31 +0000
@@ -2,7 +2,9 @@
22
3OAuthMain {3OAuthMain {
4 creationComponent: OAuth {4 creationComponent: OAuth {
5 function completeCreation(reply) {5 property var __meData
6
7 function getUserName(reply, callback) {
6 console.log("Access token: " + reply.AccessToken)8 console.log("Access token: " + reply.AccessToken)
7 var http = new XMLHttpRequest()9 var http = new XMLHttpRequest()
8 var url = "https://graph.facebook.com/me?access_token=" + reply.AccessToken;10 var url = "https://graph.facebook.com/me?access_token=" + reply.AccessToken;
@@ -12,22 +14,24 @@
12 if (http.status == 200) {14 if (http.status == 200) {
13 console.log("ok")15 console.log("ok")
14 console.log("response text: " + http.responseText)16 console.log("response text: " + http.responseText)
15 var response = JSON.parse(http.responseText)17 __meData = JSON.parse(http.responseText)
16 account.updateDisplayName(response.name)18 callback(__meData.name)
17 globalAccountService.updateSettings({19 return true
18 'id': response.id
19 })
20 account.synced.connect(finished)
21 account.sync()
22
23 } else {20 } else {
24 console.log("error: " + http.status)21 console.log("error: " + http.status)
25 cancel()22 return false
26 }23 }
27 }24 }
28 };25 };
2926
30 http.send(null);27 http.send(null);
31 }28 }
29
30 function beforeSaving(reply) {
31 globalAccountService.updateSettings({
32 'id': __meData.id
33 })
34 saveAccount()
35 }
32 }36 }
33}37}
3438
=== modified file 'qml/google/Main.qml'
--- qml/google/Main.qml 2013-06-26 11:54:11 +0000
+++ qml/google/Main.qml 2016-01-22 15:00:31 +0000
@@ -6,7 +6,7 @@
6 "AuthPath": "o/oauth2/auth?access_type=offline&approval_prompt=force"6 "AuthPath": "o/oauth2/auth?access_type=offline&approval_prompt=force"
7 }7 }
88
9 function completeCreation(reply) {9 function getUserName(reply, callback) {
10 console.log("Access token: " + reply.AccessToken)10 console.log("Access token: " + reply.AccessToken)
11 var http = new XMLHttpRequest()11 var http = new XMLHttpRequest()
12 var url = "https://www.googleapis.com/oauth2/v3/userinfo";12 var url = "https://www.googleapis.com/oauth2/v3/userinfo";
@@ -18,13 +18,11 @@
18 console.log("ok")18 console.log("ok")
19 console.log("response text: " + http.responseText)19 console.log("response text: " + http.responseText)
20 var response = JSON.parse(http.responseText)20 var response = JSON.parse(http.responseText)
21 account.updateDisplayName(response.email)21 callback(response.email)
22 account.synced.connect(finished)22 return true
23 account.sync()
24
25 } else {23 } else {
26 console.log("error: " + http.status)24 console.log("error: " + http.status)
27 cancel()25 return false
28 }26 }
29 }27 }
30 };28 };

Subscribers

People subscribed via source and target branches