Add wrong password handler

pull/1/head
yflory 5 years ago
parent 0b6539893b
commit b402b3c552

@ -1040,7 +1040,6 @@ define([
}, true); }, true);
var displayUser = function (common, data) { var displayUser = function (common, data) {
var friends = common.getMetadataMgr().getPrivateData().friends;
var avatar = h('span.cp-teams-invite-from-avatar.cp-avatar'); var avatar = h('span.cp-teams-invite-from-avatar.cp-avatar');
UIElements.displayAvatar(common, $(avatar), data.avatar, data.displayName); UIElements.displayAvatar(common, $(avatar), data.avatar, data.displayName);
return h('div.cp-teams-invite-from-author', [ return h('div.cp-teams-invite-from-author', [
@ -1049,7 +1048,7 @@ define([
]); ]);
}; };
refreshLink = function (common, cb) { refreshLink = function (common, cb, wrongPassword) {
if (!mainCategories.link) { return; } if (!mainCategories.link) { return; }
var privateData = common.getMetadataMgr().getPrivateData(); var privateData = common.getMetadataMgr().getPrivateData();
var hash = privateData.teamInviteHash; var hash = privateData.teamInviteHash;
@ -1072,7 +1071,9 @@ define([
var errorBlock; var errorBlock;
var c = [ var c = [
h('h2', Messages.team_inviteTitle || 'Team invitation'), // XXX h('h2', Messages.team_inviteTitle || 'Team invitation'), // XXX
errorBlock = h('div.alert.alert-danger', {style: 'display: none;'}), errorBlock = h('div.alert.alert-danger',
wrongPassword ? undefined : {style: 'display: none;'},
wrongPassword ? Messages.drive_sfPasswordError : undefined),
div div
]; ];
// "cb" will put the content into the UI. // "cb" will put the content into the UI.
@ -1126,6 +1127,15 @@ define([
// XXX if DELETED, password prompt again? // XXX if DELETED, password prompt again?
console.error(obj.error); console.error(obj.error);
waitFor.abort(); waitFor.abort();
if (obj.error === 'INVALID_INVITE_CONTENT') {
// Wrong password...
var $divLink = $('div.cp-team-link').empty();
if ($divLink.length) {
refreshLink(common, function (content) {
$divLink.append(content);
}, true);
}
}
return; return;
} }
// No error: join successful! // No error: join successful!

Loading…
Cancel
Save