fixed auth popup message

This commit is contained in:
antelle 2017-06-11 19:41:56 +02:00
parent bee819cc98
commit 51d172c79a
2 changed files with 11 additions and 8 deletions

View File

@ -145,15 +145,15 @@ _.extend(StorageBase.prototype, {
.replace('{cid}', encodeURIComponent(opts.clientId))
.replace('{scope}', encodeURIComponent(opts.scope))
.replace('{url}', encodeURIComponent(this._getOauthRedirectUrl()));
this.logger.debug('OAuth popup opened');
this.logger.debug('OAuth: popup opened');
if (!this._openPopup(url, 'OAuth', opts.width, opts.height)) {
callback('cannot open popup');
callback('OAuth: cannot open popup');
}
const popupClosed = () => {
Backbone.off('popup-closed', popupClosed);
window.removeEventListener('message', windowMessage);
this.logger.error('OAuth error', 'popup closed');
callback('popup closed');
callback('OAuth: popup closed');
};
const windowMessage = e => {
if (!e.data) {
@ -171,7 +171,7 @@ _.extend(StorageBase.prototype, {
const token = this._oauthMsgToToken(message);
if (token.error) {
this.logger.error('OAuth error', token.error, token.errorDescription);
callback(token.error);
callback('OAuth: ' + token.error);
} else {
this._oauthToken = token;
this.runtimeData.set(this.name + 'OAuthToken', token);

View File

@ -600,10 +600,13 @@ const OpenView = Backbone.View.extend({
icon.toggleClass('flip3d', false);
this.busy = false;
if (err || !files) {
Alerts.error({
header: Locale.openError,
body: Locale.openListErrorBody + '<pre class="modal__pre">' + _.escape(err.toString()) + '</pre>'
});
err = err ? err.toString() : '';
if (err.lastIndexOf('OAuth', 0) !== 0) {
Alerts.error({
header: Locale.openError,
body: Locale.openListErrorBody + '<pre class="modal__pre">' + _.escape(err.toString()) + '</pre>'
});
}
return;
}