From 40ca7e1e36b409353d2b2ffb3c39ed27a93621b9 Mon Sep 17 00:00:00 2001 From: joshuaruesweg Date: Sat, 13 Jun 2020 16:50:52 +0200 Subject: [PATCH] Add method to check, whether a user must confirm his email on change --- com.woltlab.wcf/templates/accountManagement.tpl | 2 +- wcfsetup/install/files/lib/data/user/User.class.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/com.woltlab.wcf/templates/accountManagement.tpl b/com.woltlab.wcf/templates/accountManagement.tpl index bf7285df53..1d90843497 100644 --- a/com.woltlab.wcf/templates/accountManagement.tpl +++ b/com.woltlab.wcf/templates/accountManagement.tpl @@ -137,7 +137,7 @@ {event name='changeEmailFields'} - {if REGISTER_ACTIVATION_METHOD & 1 && $__wcf->getUser()->reactivationCode != 0} + {if $__wcf->user->mustSelfEmailConfirm() && $__wcf->getUser()->reactivationCode != 0}
diff --git a/wcfsetup/install/files/lib/data/user/User.class.php b/wcfsetup/install/files/lib/data/user/User.class.php index 9bbc5284d1..b5a3583c4f 100644 --- a/wcfsetup/install/files/lib/data/user/User.class.php +++ b/wcfsetup/install/files/lib/data/user/User.class.php @@ -684,4 +684,14 @@ final class User extends DatabaseObject implements IRouteController, IUserConten public function canEmailConfirm() { return REGISTER_ACTIVATION_METHOD & self::REGISTER_ACTIVATION_USER && !$this->isEmailConfirmed(); } + + /** + * Returns true, if the user must confirm his email by themself. + * + * @return boolean + * @since 5.3 + */ + public function mustSelfEmailConfirm() { + return REGISTER_ACTIVATION_METHOD & self::REGISTER_ACTIVATION_USER; + } } -- 2.20.1