From 75632e70f0d49048f4ce72a0fa8bbcbcd7b2d312 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 29 Aug 2019 12:02:05 +0200 Subject: Provide email address verification feature (#2481) * Add an email field to the profile page I reuse the `mail_login` from the configuration. I'm not sure if it's useful today (I would say it was used when Persona login was available). A good improvement would be to rename `mail_login` into `email` so it would be more intuitive to use. * Add boolean to the conf to force email validation This commit only adds a configuration item. * Add email during registration if email must be validated * Set email token to validate when email changes * Block access to FreshRSS if email is not validated * Send email when address is changed * Allow to resend the validation email * Allow the user to change its email while blocked * Document the email validation feature * fixup! Allow the user to change its email while blocked * tec: Autoload PHPMailer lib * Validate email address format * Add feedback on validation email resend action * Allow to logout when user is blocked * fix: Change default email "from" * Reorganize i18n keys * Complete all the locales with default english * Hide sidebar (profile page) if email is not validated * Check email requirements on registration * Allow admin to specify email when creating users * Don't check email format if value is empty * Remove trailing comma in userController Co-Authored-By: Alexandre Alapetite * Set PHPMailer validator to html5 before sending email * fixup! Remove trailing comma in userController --- app/layout/simple.phtml | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 app/layout/simple.phtml (limited to 'app/layout/simple.phtml') diff --git a/app/layout/simple.phtml b/app/layout/simple.phtml new file mode 100644 index 000000000..5546966be --- /dev/null +++ b/app/layout/simple.phtml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + () + + +
+
+ + render(); ?> +
+ +notification)) { + $msg = $this->notification['content']; + $status = $this->notification['type']; + + invalidateHttpCache(); + } +?> +
+ + +
+ + + -- cgit v1.2.3 From 84f9311fd53f5fa58ae55986ece9bfa7dac455c1 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 29 Aug 2019 18:08:43 +0200 Subject: fix: Fix "validate email"-related issues (#2512) * fix: Make sure $disable_aside is initialized There was a warning for an uninitialized variable, hidden in production but visible in development mode. * fix: Allow to delete account when email isn't validated --- app/Controllers/userController.php | 1 + app/FreshRSS.php | 4 +++- app/layout/simple.phtml | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) (limited to 'app/layout/simple.phtml') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 9e909a3b5..a1d649c0a 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -123,6 +123,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { } $email_not_verified = FreshRSS_Context::$user_conf->email_validation_token !== ''; + $this->view->disable_aside = false; if ($email_not_verified) { $this->view->_layout('simple'); $this->view->disable_aside = true; diff --git a/app/FreshRSS.php b/app/FreshRSS.php index c48ad2093..d472a2147 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -153,7 +153,9 @@ class FreshRSS extends Minz_FrontController { Minz_Request::is('user', 'validateEmail') || Minz_Request::is('user', 'sendValidationEmail') || Minz_Request::is('user', 'profile') || - Minz_Request::is('auth', 'logout') + Minz_Request::is('user', 'delete') || + Minz_Request::is('auth', 'logout') || + Minz_Request::is('javascript', 'nonce') ); if ($email_not_verified && !$action_is_allowed) { Minz_Request::forward(array( diff --git a/app/layout/simple.phtml b/app/layout/simple.phtml index 5546966be..b62e35988 100644 --- a/app/layout/simple.phtml +++ b/app/layout/simple.phtml @@ -5,6 +5,9 @@ + -- cgit v1.2.3 From 7a5236de3f13f08b8c51eb183c0dcf1c8c85beca Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 23 Oct 2019 11:18:20 +0200 Subject: Take advantage of PHP 5.4+ short echo (#2585) * Take advantage of PHP 5.4+ short echo https://php.net/migration54.new-features thanks to https://github.com/FreshRSS/FreshRSS/pull/2495 Use `` instead of `` 10kB of code saved :-) Done with regular expression: ``` <\?php echo (.+?);? *\?> ``` * Try Travis fix https://github.com/squizlabs/PHP_CodeSniffer/issues/2045#issuecomment-395238272 --- app/install.php | 190 +++++++++++----------- app/layout/aside_configure.phtml | 52 +++--- app/layout/aside_feed.phtml | 68 ++++---- app/layout/aside_stats.phtml | 14 +- app/layout/aside_subscription.phtml | 14 +- app/layout/header.phtml | 72 ++++---- app/layout/layout.phtml | 28 ++-- app/layout/nav_entries.phtml | 6 +- app/layout/nav_menu.phtml | 80 ++++----- app/layout/simple.phtml | 34 ++-- app/views/auth/formLogin.phtml | 22 +-- app/views/auth/index.phtml | 40 ++--- app/views/auth/register.phtml | 28 ++-- app/views/configure/archiving.phtml | 46 +++--- app/views/configure/display.phtml | 104 ++++++------ app/views/configure/queries.phtml | 60 +++---- app/views/configure/reading.phtml | 126 +++++++------- app/views/configure/sharing.phtml | 50 +++--- app/views/configure/shortcut.phtml | 114 ++++++------- app/views/configure/system.phtml | 46 +++--- app/views/error/index.phtml | 6 +- app/views/extension/index.phtml | 38 ++--- app/views/feed/add.phtml | 58 +++---- app/views/helpers/category/update.phtml | 32 ++-- app/views/helpers/extension/configure.phtml | 8 +- app/views/helpers/extension/details.phtml | 12 +- app/views/helpers/feed/update.phtml | 160 +++++++++--------- app/views/helpers/index/normal/entry_bottom.phtml | 38 ++--- app/views/helpers/index/normal/entry_header.phtml | 12 +- app/views/helpers/logs_pagination.phtml | 12 +- app/views/helpers/pagination.phtml | 16 +- app/views/importExport/index.phtml | 36 ++-- app/views/index/about.phtml | 26 +-- app/views/index/global.phtml | 16 +- app/views/index/logs.phtml | 14 +- app/views/index/normal.phtml | 24 +-- app/views/index/reader.phtml | 28 ++-- app/views/index/rss.phtml | 22 +-- app/views/index/tos.phtml | 10 +- app/views/stats/idle.phtml | 18 +- app/views/stats/index.phtml | 60 +++---- app/views/stats/repartition.phtml | 34 ++-- app/views/subscription/bookmarklet.phtml | 20 +-- app/views/subscription/feed.phtml | 4 +- app/views/subscription/index.phtml | 70 ++++---- app/views/update/apply.phtml | 4 +- app/views/update/checkInstall.phtml | 18 +- app/views/update/index.phtml | 18 +- app/views/user/manage.phtml | 66 ++++---- app/views/user/profile.phtml | 68 ++++---- app/views/user/validateEmail.phtml | 12 +- app/views/user_mailer/email_need_validation.txt | 6 +- docs/en/developers/03_Backend/05_Extensions.md | 6 +- docs/fr/developers/03_Backend/05_Extensions.md | 6 +- phpcs.xml | 4 +- 55 files changed, 1089 insertions(+), 1087 deletions(-) (limited to 'app/layout/simple.phtml') diff --git a/app/install.php b/app/install.php index f8bc6dd4e..96bee34a1 100644 --- a/app/install.php +++ b/app/install.php @@ -334,18 +334,18 @@ function printStep0() { $languages = Minz_Translate::availableLanguages(); ?> -

+

- +
- +
@@ -354,10 +354,10 @@ function printStep0() {
- - + + - +
@@ -369,118 +369,118 @@ function printStep0() { function printStep1() { $res = checkRequirements(); ?> - + -

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

-

+

- - + + - + -

+

-

+

-

+

- +
- +
+
- +
- +
- +
- +
- +
- +
- +
- +
- - + + - +
@@ -576,23 +576,23 @@ function printStep3() { $user_default_config = Minz_Configuration::get('default_user'); ?> -

+

-

+

- +
- +
- +
- +
- +
- tabindex="5" /> - + tabindex="5" /> +
- - + +
- - + + - +
@@ -635,14 +635,14 @@ function printStep3() { function printStep4() { ?> -

- +

+ -

+

- <?php echo _t('install.title'); ?> - - + <?= _t('install.title') ?> + +
-

-

+

+

@@ -729,6 +729,6 @@ case 5: ?>
- + diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 747858f4e..1267f747c 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -1,54 +1,54 @@ diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 637acf4a4..4d5682001 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -8,30 +8,30 @@ } ?> -
- +
+
- - + +
- + - +
- - + +
diff --git a/app/views/auth/register.phtml b/app/views/auth/register.phtml index b90950510..4233f7fd4 100644 --- a/app/views/auth/register.phtml +++ b/app/views/auth/register.phtml @@ -1,36 +1,36 @@
-

+

-
- + +
- - + +
show_email_field) { ?>
- +
- +
- +
show_tos_checkbox) { ?>
@@ -42,11 +42,11 @@ 'php', true )); ?> - - - + + +
-

+

diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 0387a2b96..7d76e4dcc 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -1,17 +1,17 @@ partial('aside_configure'); ?>
- + -
- - -

+ + + +

- +
- () + ?> ()
@@ -94,7 +94,7 @@
-
@@ -102,46 +102,46 @@
- - + +
- -
- + + +
- +
- nb_total), format_bytes($this->size_user)); ?> + nb_total), format_bytes($this->size_user)) ?>
- +
-
- + +
- - + +
- +
- size_total); ?> + size_total) ?>
diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 60b7748c5..c1cfecc2a 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -1,47 +1,47 @@ partial('aside_configure'); ?>
- + -
- - + + +
- +
- - +
- +
    themes); $i = 1; ?> themes as $theme) { ?> - theme === $theme['id']) {echo "checked";}?> value="" data-leave-validation="theme === $theme['id']) ? 1 : 0; ?>"/> + theme === $theme['id']) {echo "checked";}?> value="" data-leave-validation="theme === $theme['id']) ? 1 : 0 ?>"/>
  • - +
    -
    -
    -
    +
    +
    +
  • @@ -52,84 +52,84 @@ content_width; ?>
    - +
    - + - - -
    - + - - - - - - - + + + + + + + - - - + + + - - - + + + - - - - - + + + + + - - + +
     
    topline_read ? ' checked="checked"' : ''; ?> data-leave-validation="topline_read; ?>"/>topline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="topline_favorite; ?>"/>topline_read ? ' checked="checked"' : '' ?> data-leave-validation="topline_read ?>"/>topline_favorite ? ' checked="checked"' : '' ?> data-leave-validation="topline_favorite ?>"/> topline_display_authors ? ' checked="checked"' : ''; ?> data-leave-validation="topline_display_authors; ?>"/>topline_date ? ' checked="checked"' : ''; ?> data-leave-validation="topline_date; ?>"/>topline_link ? ' checked="checked"' : ''; ?> data-leave-validation="topline_link; ?>"/>topline_display_authors ? ' checked="checked"' : '' ?> data-leave-validation="topline_display_authors ?>"/>topline_date ? ' checked="checked"' : '' ?> data-leave-validation="topline_date ?>"/>topline_link ? ' checked="checked"' : '' ?> data-leave-validation="topline_link ?>"/>
    bottomline_read ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_read; ?>"/>bottomline_favorite ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_favorite; ?>"/>bottomline_tags ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_tags; ?>"/>bottomline_sharing ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_sharing; ?>"/>bottomline_read ? ' checked="checked"' : '' ?> data-leave-validation="bottomline_read ?>"/>bottomline_favorite ? ' checked="checked"' : '' ?> data-leave-validation="bottomline_favorite ?>"/>bottomline_tags ? ' checked="checked"' : '' ?> data-leave-validation="bottomline_tags ?>"/>bottomline_sharing ? ' checked="checked"' : '' ?> data-leave-validation="bottomline_sharing ?>"/> bottomline_date ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_date; ?>"/>bottomline_link ? ' checked="checked"' : ''; ?> data-leave-validation="bottomline_link; ?>"/>bottomline_date ? ' checked="checked"' : '' ?> data-leave-validation="bottomline_date ?>"/>bottomline_link ? ' checked="checked"' : '' ?> data-leave-validation="bottomline_link ?>"/>

    - +
    - +
    - - + +
    diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml index baaf74954..a0f600b5d 100644 --- a/app/views/configure/queries.phtml +++ b/app/views/configure/queries.phtml @@ -1,70 +1,70 @@ partial('aside_configure'); ?>
    - + -
    - - + + + queries as $key => $query) { ?> -
    -
    '> - - + + sharing as $key => $share_options) { $share = FreshRSS_Share::get($share_options['type']); $share->update($share_options); ?> -
    +
    - - - + + +
    - + formType() === 'advanced') { ?> - + - + - +
    formType() === 'advanced') { ?> - +
    @@ -52,19 +52,19 @@
    - +
    - - + +
    diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index 412ea676d..4412266cc 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -1,181 +1,181 @@ partial('aside_configure'); ?>
    - + list_keys as $key) { ?> - shortcuts; ?> -
    - - + + + - + - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - + -

    +

    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    -

    +

    - +
    - +
    - +
    - +
    - +
    - +
    - - + +
    - +
    - +
    - +
    - +
    - +
    - - + +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - - + +
    - +
    - +
    - +
    - +
    - - + +
    diff --git a/app/views/configure/system.phtml b/app/views/configure/system.phtml index eb0e68dfc..1a718e20f 100644 --- a/app/views/configure/system.phtml +++ b/app/views/configure/system.phtml @@ -1,31 +1,31 @@ partial('aside_configure'); ?>
    - + -
    - - + + +
    - +
    - +
    - +
    - +
    - +
    - - + +
    @@ -47,41 +47,41 @@ name="force-email-validation" id="force-email-validation" value="1" - force_email_validation ? 'checked="checked"' : ''; ?> - data-leave-validation="force_email_validation; ?>" + force_email_validation ? 'checked="checked"' : '' ?> + data-leave-validation="force_email_validation ?>" /> - +
    - +
    - +
    - +
    - +
    - +
    - - + +
    - - + +
    diff --git a/app/views/error/index.phtml b/app/views/error/index.phtml index 8fd74e8bf..d5618d54c 100644 --- a/app/views/error/index.phtml +++ b/app/views/error/index.phtml @@ -1,9 +1,9 @@
    -

    code; ?>

    +

    code ?>

    - errorMessage, ENT_NOQUOTES, 'UTF-8'); ?>
    - + errorMessage, ENT_NOQUOTES, 'UTF-8') ?>
    +

    diff --git a/app/views/extension/index.phtml b/app/views/extension/index.phtml index 6439a0333..f5c5bf032 100644 --- a/app/views/extension/index.phtml +++ b/app/views/extension/index.phtml @@ -1,14 +1,14 @@ partial('aside_configure'); ?>
    - + -

    +

    - + extension_list['system'])) { ?> -

    +

    extension_list['system'] as $ext) { $this->ext_details = $ext; @@ -18,7 +18,7 @@ extension_list['user'])) { ?> -

    +

    extension_list['user'] as $ext) { $this->ext_details = $ext; @@ -30,34 +30,34 @@ if (empty($this->extension_list['system']) && empty($this->extension_list['user'])) { ?> -

    +

    available_extensions)) { ?> -

    +

    - - - - + + + + available_extensions as $ext) { ?> - - - + + +
    - + extensions_installed[$ext['name']])) { ?> extensions_installed[$ext['name']], $ext['version']) >= 0) { ?> - + extensions_installed[$ext['name']] != $ext['version']) { ?> - + @@ -69,8 +69,8 @@ extension) ? ' class="active"' : ''; ?> -> -
    > +> +
    > extension)) { $this->renderHelper('extension/configure'); diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml index 340970b25..e39f45a86 100644 --- a/app/views/feed/add.phtml +++ b/app/views/feed/add.phtml @@ -1,90 +1,90 @@ feed) { ?>
    -

    +

    load_ok) { ?> -

    +

    -
    - - + + + load_ok) { ?>
    - +
    - +
    feed->description(); if ($desc != '') { ?>
    - +
    - +
    - +
    - feed->website(); ?> - + feed->website() ?> +
    - +
    - - + +
    - +
    - +
    - + feed->httpAuth(false); ?>
    - +
    - +
    - +
    - +
    - +
    - - + +
    diff --git a/app/views/helpers/category/update.phtml b/app/views/helpers/category/update.phtml index 31482f163..6a4c041ba 100644 --- a/app/views/helpers/category/update.phtml +++ b/app/views/helpers/category/update.phtml @@ -1,17 +1,17 @@
    -

    category->name(); ?>

    +

    category->name() ?>

    - +
    -
    - - + + +
    - +
    - category->id() == FreshRSS_CategoryDAO::DEFAULTCATEGORYID ? 'disabled="disabled"' : ''; ?> /> @@ -20,21 +20,21 @@
    - + + data-str-confirm="" + formaction="category->id()) ?>" + formmethod="post"> category->isDefault()): ?> + data-str-confirm="" + formaction="category->id()) ?>" + formmethod="post">
    - + category->attributes('archiving'); if (empty($archiving)) { @@ -138,7 +138,7 @@