summaryrefslogtreecommitdiff
path: root/alpine/imap.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2021-12-04 15:18:14 -0700
committerEduardo Chappa <chappa@washington.edu>2021-12-04 15:18:14 -0700
commit34645259b43096433f09c640cd2029026149052d (patch)
tree681f57bb7cd9fb093f01a7907f0b3ed7437249d1 /alpine/imap.c
parent90d819144d14e3ca375ead5aa2c3b3158248780a (diff)
downloadalpine-34645259b43096433f09c640cd2029026149052d.tar.xz
* In addition to the previous commit, make sure to suggest the correct
flow when the flow is configured incorrectly.
Diffstat (limited to 'alpine/imap.c')
-rw-r--r--alpine/imap.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/alpine/imap.c b/alpine/imap.c
index 8fada329..f078f779 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -866,7 +866,7 @@ mm_login_oauth2(NETMBX *mb, char *user, char *method,
x = oauth2_get_client_info(oa2list->name, user);
if(!x) return; /* user cancelled, let's get out of here */
if(x){
- int error = 0;
+ int error = 0, authorize = 0, device = 0;
if(x->flow){
for(oa2list = alpine_oauth2_list;
oa2list && oa2list->host != NULL && oa2list->host[0] != NULL;
@@ -877,6 +877,8 @@ mm_login_oauth2(NETMBX *mb, char *user, char *method,
if(i < OAUTH2_TOT_EQUIV && oa2list->host[i] != NULL){
char *flow = oa2list->server_mthd[0].name ? "Authorize"
: (oa2list->server_mthd[1].name ? "Device" : NULL);
+ authorize += oa2list->server_mthd[0].name ? 1 : 0;
+ device += oa2list->server_mthd[1].name ? 1 : 0;
if(flow && !strucmp(x->flow, flow)) break; /* found it */
}
}
@@ -885,8 +887,16 @@ mm_login_oauth2(NETMBX *mb, char *user, char *method,
}
else error++;
if(error){
- if(x->flow)
- q_status_message1(SM_ORDER | SM_DING, 3, 3, _("Unrecognized flow type \"%s\". Use \"Authorize\" or \"Device\""), x->flow);
+ if(x->flow){
+ snprintf(tmp_20k_buf, SIZEOF_20KBUF, _("%s does not support or recognize flow type \"%s\". Use %s%s%s"),
+ mb->orighost,
+ x->flow,
+ authorize ? "\"Authorize\"" : "",
+ authorize ? (device ? " or " : "") : "",
+ device ? "\"Device\"" : "");
+ tmp_20k_buf[SIZEOF_20KBUF-1] = '\0';
+ q_status_message(SM_ORDER | SM_DING, 3, 5, tmp_20k_buf);
+ }
else
q_status_message(SM_ORDER | SM_DING, 3, 3, _("Configuration does not specify flow type. Use \"Authorize\" or \"Device\""));
}