diff --git a/public_html/media/css/auth.css b/public_html/media/css/auth.css index 03059c56..513389ed 100644 --- a/public_html/media/css/auth.css +++ b/public_html/media/css/auth.css @@ -11,3 +11,20 @@ form.auth p { text-align: center; margin: 10px 0; } + +form.auth .help { + opacity: .5; + margin-top: 1em; + font-size: small; +} +form.auth .help p { + margin: 0; + text-align: left; +} +form.auth .help label+div { + float: left; +} +form.auth .help ul { + margin: 0; + padding: 0; +} diff --git a/src/Controllers/UserController.php b/src/Controllers/UserController.php index fd290d8a..e3e579af 100644 --- a/src/Controllers/UserController.php +++ b/src/Controllers/UserController.php @@ -550,4 +550,31 @@ class UserController AuthController::doReLog(); } } + + + + /** + * @route /activation-retry/ + */ + public function activationRetryAction() + { + $this->context->subTitle = 'activation retry'; + + $this->context->stylesheets []= 'auth.css'; + $this->context->viewName = 'user-select'; + if (InputHelper::get('submit')) + { + $name = InputHelper::get('name'); + $user = Model_User::locate($name); + if (empty($user->email_unconfirmed)) + { + if (!empty($user->email_confirmed)) + throw new SimpleException('E-mail was already confirmed; activation skipped'); + else + throw new SimpleException('This user has no e-mail specified; activation cannot proceed'); + } + self::sendEmailChangeConfirmation($user); + StatusHelper::success('Activation e-mail resent.'); + } + } } diff --git a/src/Models/Model_User.php b/src/Models/Model_User.php index 0fdf6d4b..cbb26098 100644 --- a/src/Models/Model_User.php +++ b/src/Models/Model_User.php @@ -4,13 +4,17 @@ class Model_User extends AbstractModel public static function locate($key, $throw = true) { $user = R::findOne(self::getTableName(), 'name = ?', [$key]); - if (!$user) - { - if ($throw) - throw new SimpleException('Invalid user name "' . $key . '"'); - return null; - } - return $user; + if ($user) + return $user; + + $user = R::findOne(self::getTableName(), 'LOWER(email_confirmed) = LOWER(?)', [trim($key)]); + if ($user) + return $user; + + if ($throw) + throw new SimpleException('Invalid user name "' . $key . '"'); + + return null; } public function getAvatarUrl($size = 32) diff --git a/src/Views/auth-login.phtml b/src/Views/auth-login.phtml index 0778a3c9..7c090c29 100644 --- a/src/Views/auth-login.phtml +++ b/src/Views/auth-login.phtml @@ -16,6 +16,8 @@
+ +