From 04a0026b2af59349994cc1e37261427329fd1f6b Mon Sep 17 00:00:00 2001 From: jeanpaulHamuli Date: Fri, 19 Nov 2021 22:17:25 +0200 Subject: [PATCH] Cypht: Improve interface so user is warned about the need for App Password for Gmail-IMAP --- modules/core/functions.php | 10 ++++++++++ modules/core/site.css | 2 ++ modules/imap/output_modules.php | 2 +- modules/imap/site.css | 2 +- modules/nux/modules.php | 1 + modules/smtp/modules.php | 2 +- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/core/functions.php b/modules/core/functions.php index a377a96df6..562954881c 100644 --- a/modules/core/functions.php +++ b/modules/core/functions.php @@ -600,3 +600,13 @@ function get_special_folders($mod, $id) { } return array(); } + + +if (!hm_exists('is_gmail_server')) { +function is_gmail_server($server, $text, $disabled) { + if($server == $text && !$disabled){ + return '
Make sure your Less secure app access and your App password are enabled. For more details about the configuration of IMAP, POP and SMTP click here
'; + }else{ + return ''; + } +}} diff --git a/modules/core/site.css b/modules/core/site.css index 0da4ec268b..7cd1ab3a0b 100644 --- a/modules/core/site.css +++ b/modules/core/site.css @@ -267,3 +267,5 @@ div.unseen, .unseen .subject { font-weight: 700; } @media print { .sys_messages, .next, .prev, .folder_list, .msg_parts, .header_links, .content_title, .add_contact_row, .unsaved_icon, .add_vcal { display: none !important; } } + +div.warning_message { margin-bottom: 20px !important; } diff --git a/modules/imap/output_modules.php b/modules/imap/output_modules.php index 24e1a78e3a..faf0ebdc8d 100644 --- a/modules/imap/output_modules.php +++ b/modules/imap/output_modules.php @@ -330,7 +330,7 @@ protected function output() { $res .= '
'. ''. ' '. - ''. + ''.is_gmail_server($this->html_safe($vals['server']), 'imap.gmail.com', $disabled). ''. ''. diff --git a/modules/imap/site.css b/modules/imap/site.css index cdb04026b8..dd6db5029c 100644 --- a/modules/imap/site.css +++ b/modules/imap/site.css @@ -86,4 +86,4 @@ #archive_val { padding-left: 20px; } .attached_image { margin-right: 20px; margin-bottom: 20px; height: 200px; } -.attached_image_box { display: flex; flex-wrap: wrap; border-top: solid 1px #ddd; padding-top: 20px; padding-left: 20px; width: 100%; padding-bottom: 40px; } \ No newline at end of file +.attached_image_box { display: flex; flex-wrap: wrap; border-top: solid 1px #ddd; padding-top: 20px; padding-left: 20px; width: 100%; padding-bottom: 40px; } diff --git a/modules/nux/modules.php b/modules/nux/modules.php index 5379488ee3..32d9c43cd4 100644 --- a/modules/nux/modules.php +++ b/modules/nux/modules.php @@ -440,6 +440,7 @@ function credentials_form($details, $mod) { $res .= ''; $res .= '
'.$mod->html_safe($details['name']).'
'; $res .= $mod->trans('Enter your password for this E-mail provider to complete the connection process'); + $res .= $details['id'] === 'gmail' ? $mod->trans(', but before make sure your ').''.$mod->trans('Less secure app access ').'' .$mod->trans(' and your App Password for your gmail account are on. For more details about the configuration of IMAP, POP and SMTP click ').''.$mod->trans('here').'' : ''; $res .= '

'; $res .= '
'; diff --git a/modules/smtp/modules.php b/modules/smtp/modules.php index 56e9d6952e..ea29c51e48 100644 --- a/modules/smtp/modules.php +++ b/modules/smtp/modules.php @@ -1045,7 +1045,7 @@ protected function output() { ''. ''. ' '. - ''. + ''.is_gmail_server($this->html_safe($vals['server']), 'smtp.gmail.com', $disabled). '