summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2024-01-21 21:38:25 -0700
committerEduardo Chappa <chappa@washington.edu>2024-01-21 21:38:25 -0700
commitf7deb74aa5612d4d49da4ec179e61124e8fa0763 (patch)
tree8af49c5104a5c7b223b9c7d6f155e90ae056536b
parent9e223693bd1bb9d6ede1d05f62cc1cf009c23c62 (diff)
downloadalpine-f7deb74aa5612d4d49da4ec179e61124e8fa0763.tar.xz
* Add the username information to the initial xoauth2 screen
that tells users that Alpine needs authorization to open their account.
-rw-r--r--alpine/imap.c14
-rw-r--r--alpine/imap.h4
-rw-r--r--imap/src/c-client/mail.h4
-rw-r--r--imap/src/c-client/oauth2_aux.c4
4 files changed, 13 insertions, 13 deletions
diff --git a/alpine/imap.c b/alpine/imap.c
index 78081fb0..45f2c97e 100644
--- a/alpine/imap.c
+++ b/alpine/imap.c
@@ -357,7 +357,7 @@ oauth2_elapsed_done(void *aux_valuep)
}
void
-oauth2_set_device_info(OAUTH2_S *oa2, char *method)
+oauth2_set_device_info(OAUTH2_S *oa2, char *method, NETMBX *mb)
{
char tmp[MAILTMPLEN];
char *name = (char *) oa2->name;
@@ -386,12 +386,12 @@ oauth2_set_device_info(OAUTH2_S *oa2, char *method)
so_puts(in_store, "<HTML><P>");
sprintf(tmp, _("<CENTER>Authorizing Alpine Access to %s Email Services</CENTER>"), name);
so_puts(in_store, tmp);
- sprintf(tmp, _("<P>Alpine is attempting to log you into your %s account, using the %s method."), name, method),
+ sprintf(tmp, _("<P>Alpine is attempting to log you into your %s account with username <B>%s</B> using the %s method."), name, mb->user, method),
so_puts(in_store, tmp);
if(deviceinfo->verification_uri && deviceinfo->user_code){
sprintf(tmp,
- _("</P><P>To sign in, use a web browser to open the page <A HREF=\"%s\">%s</A> and enter the code \"%s\" without the quotes."),
+ _("</P><P>To sign in, use a web browser to open the page <A HREF=\"%s\">%s</A> and enter the code %s."),
deviceinfo->verification_uri, deviceinfo->verification_uri, deviceinfo->user_code);
so_puts(in_store, tmp);
}
@@ -470,7 +470,7 @@ try_wantto:
tmp_20k_buf[SIZEOF_20KBUF-1] = '\0';
snprintf(tmp_20k_buf+strlen(tmp_20k_buf), SIZEOF_20KBUF-strlen(tmp_20k_buf),
- _("Alpine is attempting to log you into your %s account, using the %s method. "), name, method),
+ _("Alpine is attempting to log you into your %s account with username %s using the %s method."), name, mb->user, method);
tmp_20k_buf[SIZEOF_20KBUF-1] = '\0';
if(deviceinfo->verification_uri && deviceinfo->user_code){
@@ -530,7 +530,7 @@ try_wantto:
}
char *
-oauth2_get_access_code(unsigned char *url, char *method, OAUTH2_S *oauth2, int *tryanother)
+oauth2_get_access_code(unsigned char *url, char *method, OAUTH2_S *oauth2, NETMBX *mb, int *tryanother)
{
char tmp[MAILTMPLEN];
char *code = NULL;
@@ -551,7 +551,7 @@ oauth2_get_access_code(unsigned char *url, char *method, OAUTH2_S *oauth2, int *
so_puts(in_store, "<HTML><BODY><P>");
sprintf(tmp, _("<CENTER>Authorizing Alpine Access to %s Email Services</CENTER>"), oauth2->name);
so_puts(in_store, tmp);
- sprintf(tmp, _("<P>Alpine is attempting to log you into your %s account, using the %s method."), oauth2->name, method),
+ sprintf(tmp, _("<P>Alpine is attempting to log you into your %s account with username <B>%s</B> using the %s method."), oauth2->name, mb->user, method),
so_puts(in_store, tmp);
if(strucmp((char *) oauth2->name, (char *) GMAIL_NAME) == 0 && strstr(url, (char *) GMAIL_ID) != NULL){
@@ -662,7 +662,7 @@ try_wantto:
tmp_20k_buf[SIZEOF_20KBUF-1] = '\0';
snprintf(tmp_20k_buf+strlen(tmp_20k_buf), SIZEOF_20KBUF-strlen(tmp_20k_buf),
- _("Alpine is attempting to log you into your %s account, using the %s method."), oauth2->name, method),
+ _("Alpine is attempting to log you into your %s account with username %s using the %s method."), oauth2->name, mb->user, method);
tmp_20k_buf[SIZEOF_20KBUF-1] = '\0';
snprintf(tmp_20k_buf+strlen(tmp_20k_buf), SIZEOF_20KBUF-strlen(tmp_20k_buf),
diff --git a/alpine/imap.h b/alpine/imap.h
index e11c7abc..cc4afce0 100644
--- a/alpine/imap.h
+++ b/alpine/imap.h
@@ -33,8 +33,8 @@ void pine_sslfailure(char *, char *, unsigned long);
void mm_expunged_current(long unsigned int);
IDLIST *set_alpine_id(char *, char *);
void pine_delete_pwd(NETMBX *mb, char *user);
-char *oauth2_get_access_code(unsigned char *, char *, OAUTH2_S *, int *);
-void oauth2_set_device_info(OAUTH2_S *, char *);
+char *oauth2_get_access_code(unsigned char *, char *, OAUTH2_S *, NETMBX *, int *);
+void oauth2_set_device_info(OAUTH2_S *, char *, NETMBX *);
int oauth2_elapsed_done(void *);
UCS oauth2device_decode_reply(void *, void *);
diff --git a/imap/src/c-client/mail.h b/imap/src/c-client/mail.h
index a294afd2..0449f130 100644
--- a/imap/src/c-client/mail.h
+++ b/imap/src/c-client/mail.h
@@ -2031,9 +2031,9 @@ typedef struct xoauth_default_s {
} XOAUTH2_INFO_S;
/* Supporting external functions for XOAUTH2 and OAUTHBEARER */
-typedef char *(*oauth2getaccesscode_t) (unsigned char *, char *, OAUTH2_S *, int *);
+typedef char *(*oauth2getaccesscode_t) (unsigned char *, char *, OAUTH2_S *, NETMBX *, int *);
typedef XOAUTH2_INFO_S *(*oauth2clientinfo_t)(unsigned char *name, char *user);
-typedef void (*oauth2deviceinfo_t)(OAUTH2_S *, char *method);
+typedef void (*oauth2deviceinfo_t)(OAUTH2_S *, char *, NETMBX *);
void mm_login_oauth2_c_client_method (NETMBX *, char *, char *, OAUTH2_S *, unsigned long, int *);
void oauth2deviceinfo_get_accesscode(void *, void *);
XOAUTH2_INFO_S *new_xoauth2_info(void);
diff --git a/imap/src/c-client/oauth2_aux.c b/imap/src/c-client/oauth2_aux.c
index 60e3b88d..26730de7 100644
--- a/imap/src/c-client/oauth2_aux.c
+++ b/imap/src/c-client/oauth2_aux.c
@@ -303,7 +303,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method,
if(oauth2->devicecode.verification_uri && oauth2->devicecode.user_code){
ogdi = (oauth2deviceinfo_t) mail_parameters (NIL, GET_OA2DEVICEINFO, NIL);
- if(ogdi) (*ogdi)(oauth2, method);
+ if(ogdi) (*ogdi)(oauth2, method, mb);
}
mm_log("Got Json reply. Completed parsing.", (long) NIL);
}
@@ -378,7 +378,7 @@ mm_login_oauth2_c_client_method (NETMBX *mb, char *user, char *method,
(oauth2getaccesscode_t) mail_parameters (NIL, GET_OA2CLIENTGETACCESSCODE, NIL);
if(ogac)
- oauth2->param[OA2_Code].value = (*ogac)(url, method, oauth2, tryanother);
+ oauth2->param[OA2_Code].value = (*ogac)(url, method, oauth2, mb, tryanother);
if(server) fs_give((void **) &server);
if(url) fs_give((void **) &url);