mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-27 16:03:52 +00:00
Support logging out. Fixes #114
This commit is contained in:
@@ -144,6 +144,11 @@ iD.Connection = function() {
|
||||
return connection;
|
||||
};
|
||||
|
||||
connection.logout = function() {
|
||||
oauth.logout();
|
||||
return connection;
|
||||
};
|
||||
|
||||
connection.bboxFromAPI = bboxFromAPI;
|
||||
connection.wayFromAPI = wayFromAPI;
|
||||
connection.loadFromURL = loadFromURL;
|
||||
|
||||
@@ -35,7 +35,7 @@ iD.OAuth = function() {
|
||||
oauth.logout = function() {
|
||||
token('oauth_token', '');
|
||||
token('oauth_token_secret', '');
|
||||
return ouath;
|
||||
return oauth;
|
||||
};
|
||||
|
||||
oauth.xhr = function(options, callback) {
|
||||
|
||||
18
js/iD/id.js
18
js/iD/id.js
@@ -134,11 +134,19 @@ var iD = function(container) {
|
||||
if (connection.authenticated()) {
|
||||
connection.userDetails(function(user_details) {
|
||||
connection.user(user_details);
|
||||
d3.select('.user .hello').text('hi, ')
|
||||
.append('a')
|
||||
.attr('href', connection.url() + '/user/' + user_details.display_name)
|
||||
.attr('target', '_blank')
|
||||
.text(user_details.display_name);
|
||||
d3.select('.user').html('');
|
||||
d3.select('.user')
|
||||
.append('span')
|
||||
.text('signed in as ')
|
||||
.append('a')
|
||||
.attr('href', connection.url() + '/user/' + user_details.display_name)
|
||||
.attr('target', '_blank')
|
||||
.text(user_details.display_name);
|
||||
d3.select('.user')
|
||||
.append('a')
|
||||
.attr('class', 'logout')
|
||||
.text('logout')
|
||||
.on('click', connection.logout);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user