Skip to content

Commit fef6739

Browse files
committed
fix #909: Add OAuth step messages for improved user guidance during authentication
1 parent 51c2dc5 commit fef6739

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

essentials/api/api_auth_oauth/code.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ type MsgApiAuth struct {
2121
ProgressAuthSuccess app_msg.Message
2222
OauthSeq1 app_msg.Message
2323
OauthSeq2 app_msg.Message
24+
OauthStep1Visit app_msg.Message
25+
OauthStep2Allow app_msg.Message
26+
OauthStep3Copy app_msg.Message
2427
}
2528

2629
var (
@@ -133,7 +136,13 @@ func (z *sessionCodeAuthImpl) oauthAskCode(session api_auth.OAuthSessionData, st
133136
})
134137
url := z.oauthUrl(session, cfg, state, challenge)
135138

136-
ui.Info(MApiAuth.OauthSeq1.With("Url", url))
139+
ui.Info(MApiAuth.OauthStep1Visit)
140+
ui.Break()
141+
ui.Code(url)
142+
ui.Break()
143+
ui.Info(MApiAuth.OauthStep2Allow)
144+
ui.Break()
145+
ui.Info(MApiAuth.OauthStep3Copy)
137146

138147
code := z.oauthCode()
139148
if code == "" {

resources/messages/en/messages.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2477,7 +2477,10 @@
24772477
"essentials.api.api_auth_key.msg_console.ask_key": "Please enter your API key(s).",
24782478
"essentials.api.api_auth_key.msg_console.prompt_enter_key": "Please enter your API key(s).",
24792479
"essentials.api.api_auth_oauth.msg_api_auth.failed_or_cancelled": "Authentication failed or cancelled: {{.Cause}}",
2480-
"essentials.api.api_auth_oauth.msg_api_auth.oauth_seq1": "1. Visit the URL for the auth dialogue:\\n\\n{{.Url}}\\n\\n2. Click 'Allow' (you might have to login first):\\n3. Copy the authorization code:",
2480+
"essentials.api.api_auth_oauth.msg_api_auth.oauth_seq1": "1. Visit the URL for the auth dialogue:\n\n{{.Url}}\n\n2. Click 'Allow' (you might have to login first):\n3. Copy the authorization code:",
2481+
"essentials.api.api_auth_oauth.msg_api_auth.oauth_step1_visit": "1. Visit the URL for the auth dialogue:",
2482+
"essentials.api.api_auth_oauth.msg_api_auth.oauth_step2_allow": "2. Click 'Allow' (you might have to login first)",
2483+
"essentials.api.api_auth_oauth.msg_api_auth.oauth_step3_copy": "3. Copy the authorization code:",
24812484
"essentials.api.api_auth_oauth.msg_api_auth.oauth_seq2": "Enter the authorization code",
24822485
"essentials.api.api_auth_oauth.msg_api_auth.progress_auth_success": "Successfully authorized.",
24832486
"essentials.api.api_auth_oauth.opt_in_feature_redirect.agreement": "This feature is in an early stage of development. This is not well tested. Please proceed by typing 'yes' to agree & enable this feature.",
@@ -2528,7 +2531,7 @@
25282531
"essentials.model.mo_image.exif.desc": "EXIF data",
25292532
"essentials.model.mo_image.exif.make.desc": "The name of the manufacturer",
25302533
"essentials.model.mo_image.exif.model.desc": "The model name or model number",
2531-
"essentials.network.nw_diag.msg_network.error_unreachable": "Network unreachable: {{.Url}}.\\nPlease ensure your network connection or proxy configuration.\\nPlease specify `-proxy` option if your machine is under proxy or firewall.\\n\\nError:\\n{{.Error}}",
2534+
"essentials.network.nw_diag.msg_network.error_unreachable": "Network unreachable: {{.Url}}.\nPlease ensure your network connection or proxy configuration.\nPlease specify `-proxy` option if your machine is under proxy or firewall.\n\nError:\n{{.Error}}",
25322535
"essentials.network.nw_diag.msg_network.progress_testing": "Testing network connection...",
25332536
"essentials.network.nw_diag.msg_network.progress_testing_done": "Done",
25342537
"essentials.network.nw_diag.msg_network.progress_testing_remind": "Trying...",
@@ -3432,7 +3435,7 @@
34323435
"recipe.dev.doc.review.batch.invalid_choice": "Invalid input: {{.Input}}. Please enter 'a' to approve, 's' to skip, or 'q' to quit.",
34333436
"recipe.dev.doc.review.batch.no_unreviewed": "No unreviewed messages found.",
34343437
"recipe.dev.doc.review.batch.prompt_approve": "[a] Approve",
3435-
"recipe.dev.doc.review.batch.prompt_review": "[{{.Index}}/{{.Total}}] Key: {{.Key}}\\nMessage: {{.Message}}",
3438+
"recipe.dev.doc.review.batch.prompt_review": "[{{.Index}}/{{.Total}}] Key: {{.Key}}\nMessage: {{.Message}}",
34363439
"recipe.dev.doc.review.batch.prompt_skip": "Skipping: {{.Key}}",
34373440
"recipe.dev.doc.review.batch.prompt_stop": "[q] Quit",
34383441
"recipe.dev.doc.review.batch.session_complete": "Review session complete. Approved: {{.Approved}}, Skipped: {{.Skipped}}, Total reviewed: {{.Total}}",

0 commit comments

Comments
 (0)