in src/commands/login/index.ts [25:73]
export async function handleLogin(): Promise<void> {
generateDefaultConfig();
const cliConfig = getCliConfig();
if (!cliConfig) return;
if (
cliConfig &&
cliConfig.auth &&
cliConfig.auth.accessKeyId &&
cliConfig.auth.accessKeySecret
) {
const service = await ApiService.getInstance();
const loginStatus = await service.checkLogin(false);
if (loginStatus.success) {
logger.warn(t('login_already').d('You are already logged in.'));
const action = await inquirer.prompt([
{
type: 'list',
name: 'action',
message: t('login_existing_credentials_message').d(
'Existing credentials found. What do you want to do?'
),
choices: [
t('login_existing_credentials_action_overwrite').d(
'Overwrite existing credentials'
),
t('common_exit').d('Exit')
]
}
]);
if (action.action === t('common_exit').d('Exit')) {
return;
}
await getUserInputAuthInfo();
} else {
logger.error(
t('pre_login_failed').d(
'The previously entered Access Key ID (AK) and Secret Access Key (SK) are incorrect. Please enter them again.'
)
);
logger.info(`${t('login_logging').d('Logging in')}...`);
await getUserInputAuthInfo();
}
} else {
logger.info(`${t('login_logging').d('Logging in')}...`);
await getUserInputAuthInfo();
}
}