Skip to content

Commit 5085482

Browse files
committed
chore: login workflow messaging and dialogs
1 parent d58c6dc commit 5085482

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

src/nls/root/strings.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,7 @@ define({
15941594
"SIGNED_IN_FAILED_TITLE": "Cannot Sign In",
15951595
"SIGNED_IN_FAILED_MESSAGE": "Something went wrong while trying to sign in. Please try again.",
15961596
"SIGNED_OUT_FAILED_TITLE": "Failed to Sign Out",
1597-
"SIGNED_OUT_FAILED_MESSAGE": "Something went wrong while trying to sign out. Please try again.",
1597+
"SIGNED_OUT_FAILED_MESSAGE": "Something went wrong while logging out. Press OK to open <a href='https://account.phcode.dev/#advanced'>account.phcode.dev</a> where you can logout manually.",
15981598
"VALIDATION_CODE_TITLE": "Sign In Verification Code",
15991599
"VALIDATION_CODE_MESSAGE": "Please use this Verification code to sign in to your {APP_NAME} account:",
16001600
"COPY_VALIDATION_CODE": "Copy Code",
@@ -1615,6 +1615,7 @@ define({
16151615
"CHECKING_STATUS": "Checking login status\u2026",
16161616
"NOT_SIGNED_IN_YET": "Not signed in yet. Please complete sign-in in the other tab.",
16171617
"WELCOME_BACK": "Welcome back, {0}!",
1618+
"POPUP_BLOCKED": "Pop-up blocked. Please allow pop-ups and try again, or manually navigate to {0}",
16181619

16191620
// Collapse Folders
16201621
"COLLAPSE_ALL_FOLDERS": "Collapse All Folders",

src/services/login-browser.js

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ define(function (require, exports, module) {
102102
method: 'GET',
103103
credentials: 'include', // Include cookies
104104
headers: {
105-
'Accept': 'application/json',
106-
'Cache-Control': 'no-cache'
105+
'Accept': 'application/json'
107106
}
108107
});
109108

@@ -289,7 +288,7 @@ define(function (require, exports, module) {
289288
Dialogs.showModalDialog(
290289
DefaultDialogs.DIALOG_ID_ERROR,
291290
Strings.SIGNED_IN_FAILED_TITLE,
292-
"Pop-up blocked. Please allow pop-ups and try again, or manually navigate to " + accountURL
291+
StringUtils.format(Strings.POPUP_BLOCKED, accountURL)
293292
);
294293
return;
295294
}
@@ -310,8 +309,7 @@ define(function (require, exports, module) {
310309
method: 'POST',
311310
credentials: 'include', // Include cookies
312311
headers: {
313-
'Content-Type': 'application/json',
314-
'Cache-Control': 'no-cache'
312+
'Content-Type': 'application/json'
315313
}
316314
});
317315

@@ -324,7 +322,7 @@ define(function (require, exports, module) {
324322
Dialogs.showModalDialog(
325323
DefaultDialogs.DIALOG_ID_INFO,
326324
Strings.SIGNED_OUT,
327-
"You have been signed out successfully."
325+
Strings.SIGNED_OUT
328326
);
329327
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, 'browserLogoutOK', 'browser');
330328
return;
@@ -333,22 +331,28 @@ define(function (require, exports, module) {
333331

334332
// If we get here, there was some issue but we still signed out locally
335333
console.warn('Logout may not have completed on server, but signed out locally');
336-
Dialogs.showModalDialog(
337-
DefaultDialogs.DIALOG_ID_INFO,
338-
Strings.SIGNED_OUT,
339-
"Signed out locally. You may need to sign out from your browser as well."
334+
const dialog = Dialogs.showModalDialog(
335+
DefaultDialogs.DIALOG_ID_ERROR,
336+
Strings.SIGNED_OUT_FAILED_TITLE,
337+
Strings.SIGNED_OUT_FAILED_MESSAGE
340338
);
339+
dialog.done(() => {
340+
window.open(_getAccountWebURL() + "#advanced", '_blank');
341+
});
341342
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, 'browserLogoutPartial', 'browser');
342343

343344
} catch (error) {
344345
// Always reset local state even on network error
345346
await _resetBrowserLogin();
346347
console.error("Network error during logout:", error);
347-
Dialogs.showModalDialog(
348-
DefaultDialogs.DIALOG_ID_INFO,
349-
Strings.SIGNED_OUT,
350-
"Signed out locally due to network error. You may need to sign out from your browser as well."
348+
const dialog = Dialogs.showModalDialog(
349+
DefaultDialogs.DIALOG_ID_ERROR,
350+
Strings.SIGNED_OUT_FAILED_TITLE,
351+
Strings.SIGNED_OUT_FAILED_MESSAGE
351352
);
353+
dialog.done(() => {
354+
window.open(_getAccountWebURL() + "#advanced", '_blank');
355+
});
352356
Metrics.countEvent(Metrics.EVENT_TYPE.AUTH, 'browserLogoutError', 'browser');
353357
}
354358
}

0 commit comments

Comments
 (0)