mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-21 11:16:36 +02:00
fix confusing behaviour after logging out in the standalone build of iD (#10683)
when user logs out of osm.org via the logout button: the popup continues to the login screen, which if completed now logs the user back into iD with the new credentials
This commit is contained in:
@@ -50,6 +50,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
* Fix grid lines from showing up on background map tiles in certain situations (semi-transparent tiles or fractional browser zoom level) ([#10594], thanks [@Nekzuris])
|
||||
* Prevent search results from sometimes getting stuck in the highlighted state when mouse-hovering the list of search results while typing ([#10661])
|
||||
* Allow tiles in minimap to be slightly underzoomed, preventing them from blacking out on low map zoom levels ([#10653])
|
||||
* Fix confusing behaviour after logging out in the standalone build of iD ([#10683], thanks [@k-yle])
|
||||
#### :earth_asia: Localization
|
||||
* Update Sinitic languages in the Multilingual Names field ([#10488], thanks [@winstonsung])
|
||||
* Update the list of languages in the Wikipedia field ([#10489])
|
||||
@@ -74,6 +75,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
|
||||
[#10634]: https://github.com/openstreetmap/iD/issues/10634
|
||||
[#10650]: https://github.com/openstreetmap/iD/issues/10650
|
||||
[#10653]: https://github.com/openstreetmap/iD/issues/10653
|
||||
[#10683]: https://github.com/openstreetmap/iD/issues/10683
|
||||
[#10684]: https://github.com/openstreetmap/iD/pull/10684
|
||||
[@winstonsung]: https://github.com/winstonsung/
|
||||
[@Nekzuris]: https://github.com/Nekzuris
|
||||
|
||||
@@ -1417,7 +1417,8 @@ export default {
|
||||
},
|
||||
|
||||
|
||||
authenticate: function(callback) {
|
||||
/** @param {import('osm-auth').LoginOptions} options */
|
||||
authenticate: function(callback, options) {
|
||||
var that = this;
|
||||
var cid = _connectionID;
|
||||
_userChangesets = undefined;
|
||||
@@ -1444,7 +1445,7 @@ export default {
|
||||
locale: localizer.localeCode(),
|
||||
});
|
||||
|
||||
oauth.authenticate(done);
|
||||
oauth.authenticate(done, options);
|
||||
},
|
||||
|
||||
|
||||
|
||||
+6
-24
@@ -54,7 +54,12 @@ export function uiAccount(context) {
|
||||
.on('click', e => {
|
||||
e.preventDefault();
|
||||
osm.logout();
|
||||
tryLogout();
|
||||
// OAuth2's idea of "logout" is just to get rid of the bearer token.
|
||||
// If we try to "login" again, it will just grab the token again.
|
||||
// What a user probably _really_ expects is to logout of OSM so that they can switch users.
|
||||
// So, we open a popup with a "Logout" button. After logging out, they can login again using
|
||||
// the same popup window.
|
||||
osm.authenticate(undefined, { switchUser: true });
|
||||
});
|
||||
|
||||
} else { // no user
|
||||
@@ -75,29 +80,6 @@ export function uiAccount(context) {
|
||||
}
|
||||
|
||||
|
||||
// OAuth2's idea of "logout" is just to get rid of the bearer token.
|
||||
// If we try to "login" again, it will just grab the token again.
|
||||
// What a user probably _really_ expects is to logout of OSM so that they can switch users.
|
||||
function tryLogout() {
|
||||
if (!osm) return;
|
||||
|
||||
const url = osm.getUrlRoot() + '/logout?referer=%2Flogin';
|
||||
// Create a 600x550 popup window in the center of the screen
|
||||
const w = 600;
|
||||
const h = 550;
|
||||
const settings = [
|
||||
['width', w],
|
||||
['height', h],
|
||||
['left', window.screen.width / 2 - w / 2],
|
||||
['top', window.screen.height / 2 - h / 2],
|
||||
]
|
||||
.map(x => x.join('='))
|
||||
.join(',');
|
||||
|
||||
window.open(url, '_blank', settings);
|
||||
}
|
||||
|
||||
|
||||
return function(selection) {
|
||||
if (!osm) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user