parent
76a60ed5d7
commit
039d56c260
5 changed files with 87 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
<div>
|
||||
<label class="left"> </label>
|
||||
<div class="input-wrapper">
|
||||
<button type="submit">Log in</button>
|
||||
|
||||
<input type="hidden" name="remember" value="0"/>
|
||||
<label>
|
||||
<input type="checkbox" name="remember" value="1"/>
|
||||
|
@ -28,8 +30,14 @@
|
|||
|
||||
<input type="hidden" name="submit" value="1"/>
|
||||
|
||||
<div>
|
||||
<label class="left"></label>
|
||||
<button type="submit">Log in</button>
|
||||
<div class="help">
|
||||
<label class="left"> </label>
|
||||
<div>
|
||||
<p>Problems logging in?</p>
|
||||
<ul>
|
||||
<li><a href="<?php echo \Chibi\UrlHelper::route('user', 'activation-retry') ?>">I haven't received activation e-mail</a></li>
|
||||
<li><a href="<?php echo \Chibi\UrlHelper::route('user', 'registration') ?>">I don't have account</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
21
src/Views/user-select.phtml
Normal file
21
src/Views/user-select.phtml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php if ($this->context->transport->success === true): ?>
|
||||
<?php $this->renderFile('message') ?>
|
||||
<?php else: ?>
|
||||
<form action="<?php echo \Chibi\UrlHelper::route($this->context->route->simpleControllerName, $this->context->route->simpleActionName) ?>" method="post" class="auth aligned" autocomplete="off">
|
||||
<div>
|
||||
<label class="left">User:</label>
|
||||
<div class="input-wrapper">
|
||||
<input name="name" placeholder="Name or e-mail address" type="text"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="submit" value="1"/>
|
||||
|
||||
<?php $this->renderFile('message') ?>
|
||||
|
||||
<div>
|
||||
<label class="left"> </label>
|
||||
<button type="submit">Continue</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php endif ?>
|
Loading…
Reference in a new issue