Skip to content

Commit 4d61fe2

Browse files
fix(auth): show 'Log out cancelled' when user declines logout confirmation
1 parent fa9344c commit 4d61fe2

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

packages/contentstack-auth/messages/index.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"CLI_AUTH_LOGOUT_DESCRIPTION": "User session logout",
1919
"CLI_AUTH_LOGOUT_FLAG_FORCE": "Force logging out for skipping the confirmation",
2020
"CLI_AUTH_LOGOUT_ALREADY": "You're already logged out",
21+
"CLI_AUTH_LOGOUT_CANCELLED": "Log out cancelled",
2122
"CLI_AUTH_LOGOUT_NO_AUTHORIZATIONS": "No authorizations found",
2223
"CLI_AUTH_LOGOUT_NO_AUTHORIZATIONS_USER": "No authorizations found for current user",
2324
"CLI_AUTH_WHOAMI_LOGGED_IN_AS": "You are currently logged in with email:",

packages/contentstack-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-auth",
33
"description": "Contentstack CLI plugin for authentication activities",
4-
"version": "2.0.0-beta.6",
4+
"version": "2.0.0-beta.7",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli/issues",
77
"scripts": {

packages/contentstack-auth/src/commands/auth/logout.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ export default class LogoutCommand extends BaseCommand<typeof LogoutCommand> {
8484
confirm,
8585
isAuthenticated: oauthHandler.isAuthenticated(),
8686
});
87-
log.success(messageHandler.parse('CLI_AUTH_LOGOUT_ALREADY'), this.contextDetails);
87+
const messageKey = confirm === false && oauthHandler.isAuthenticated()
88+
? 'CLI_AUTH_LOGOUT_CANCELLED'
89+
: 'CLI_AUTH_LOGOUT_ALREADY';
90+
log.success(messageHandler.parse(messageKey), this.contextDetails);
8891
}
8992
} catch (error) {
9093
log.debug('Logout failed.', { ...this.contextDetails, error: error.message });

packages/contentstack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"@contentstack/cli-audit": "~2.0.0-beta.5",
2626
"@contentstack/cli-cm-export": "~2.0.0-beta.10",
2727
"@contentstack/cli-cm-import": "~2.0.0-beta.10",
28-
"@contentstack/cli-auth": "~2.0.0-beta.6",
28+
"@contentstack/cli-auth": "~2.0.0-beta.7",
2929
"@contentstack/cli-bulk-operations": "^1.0.0-beta",
3030
"@contentstack/cli-cm-bootstrap": "~2.0.0-beta.10",
3131
"@contentstack/cli-cm-branches": "~2.0.0-beta.1",

0 commit comments

Comments
 (0)