Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(auth): update warning copy #2842

Merged
merged 4 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/src/commands/auth/token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ By default, the CLI auth token is only valid for 1 year. To generate a long-live
if (token && token.access_token.expires_in) {
const d = new Date()
d.setSeconds(d.getSeconds() + token.access_token.expires_in)
this.warn(`token will expire ${formatRelative(d, new Date())}\n${isInternal ? 'All tokens expire one year after we generate it.' : `To generate a long-lived token, use ${color.cmd('heroku authorizations:create')}.`}`)
this.warn(`token will expire ${formatRelative(d, new Date())}\n${isInternal ? 'All tokens expire one year after we generate it.' : `To generate a token that expires in one year, use ${color.cmd('heroku authorizations:create')}.`}`)
}
} catch (error: any) {
this.warn(error)
Expand Down
5 changes: 3 additions & 2 deletions packages/cli/test/unit/commands/auth/token.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ describe('auth:token', () => {
.command(['auth:token'])
.it('shows "long-term" token generation warning for non-internal users', ctx => {
expect(ctx.stdout).to.equal('foobar\n')
expect(ctx.stderr).to.contain('To generate a long-lived token, use heroku authorizations:create.')
expect(ctx.stderr).to.contain('To generate a token that expires in one year, use heroku')
expect(ctx.stderr).to.contain('authorizations:create.')
expect(ctx.stderr).to.not.contain('All tokens expire one year after we generate it.')
})

Expand All @@ -54,6 +55,6 @@ describe('auth:token', () => {
.it('shows AT2 token generation warning for internal users', ctx => {
expect(ctx.stdout).to.equal('foobar\n')
expect(ctx.stderr).to.contain('All tokens expire one year after we generate it.')
expect(ctx.stderr).to.not.contain('To generate a long-lived token, use heroku authorizations:create.')
expect(ctx.stderr).to.not.contain('To generate a token that expires in one year, use heroku authorizations:create.')
})
})
Loading