mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
Google login: Log out if wrong account
This commit is contained in:
parent
248f4a0887
commit
b557eafefb
|
|
@ -948,10 +948,9 @@
|
|||
'theme': 'dark',
|
||||
'onsuccess': function (googleUser) {
|
||||
var profile = googleUser.getBasicProfile();
|
||||
var email = profile.getEmail();
|
||||
var id_token = googleUser.getAuthResponse().id_token;
|
||||
self.close();
|
||||
app.user.passwordRename(data.username, id_token, email);
|
||||
app.user.passwordRename(data.username, id_token, data.special);
|
||||
},
|
||||
'onfailure': function (googleUser) {
|
||||
alert('sign-in failed');
|
||||
|
|
|
|||
11
js/client.js
11
js/client.js
|
|
@ -275,13 +275,12 @@
|
|||
app.send('/trn ' + name);
|
||||
}
|
||||
},
|
||||
passwordRename: function (name, password, email) {
|
||||
passwordRename: function (name, password, special) {
|
||||
var self = this;
|
||||
$.post(this.getActionPHP(), {
|
||||
act: 'login',
|
||||
name: name,
|
||||
pass: password,
|
||||
email: email,
|
||||
challstr: this.challstr
|
||||
}, Tools.safeJSON(function (data) {
|
||||
if (data && data.curuser && data.curuser.loggedin) {
|
||||
|
|
@ -290,9 +289,15 @@
|
|||
self.finishRename(name, data.assertion);
|
||||
} else {
|
||||
// wrong password
|
||||
if (special === '@gmail') {
|
||||
try {
|
||||
gapi.auth2.getAuthInstance().signOut();
|
||||
} catch (e) {}
|
||||
}
|
||||
app.addPopup(LoginPasswordPopup, {
|
||||
username: name,
|
||||
error: 'Wrong password.'
|
||||
error: 'Wrong password.',
|
||||
special: special
|
||||
});
|
||||
}
|
||||
}), 'text');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user