[Security][Exception] Security exception handling, login and register. TODO EmailNotFoundException and NicknameNotFoundException.
This commit is contained in:
parent
26af284353
commit
e9d809d441
|
@ -480,13 +480,12 @@ summary:hover .icon-details-open {
|
|||
}
|
||||
|
||||
.form-group {
|
||||
all: unset;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.form-group label {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.help-block {
|
||||
margin-top: 5px;
|
||||
margin-bottom: 10px;
|
||||
|
@ -500,6 +499,8 @@ summary:hover .icon-details-open {
|
|||
.help-block > .list-unstyled,
|
||||
.alert,
|
||||
.alert-danger {
|
||||
display: inline-block;
|
||||
|
||||
border: solid 2px #FF6347;
|
||||
background-color: #FF634733;
|
||||
border-radius: var(--unit-size);
|
||||
|
|
|
@ -97,7 +97,7 @@ class Authenticator extends AbstractFormLoginAuthenticator
|
|||
$user = DB::findOneBy('local_user', ['or' => ['nickname' => $nick, 'outgoing_email' => $nick]]);
|
||||
} catch (Exception $e) {
|
||||
throw new CustomUserMessageAuthenticationException(
|
||||
_m('\'{nickname}\' doesn\'t match any registered nickname or email.', ['nickname' => $credentials['nickname']]));
|
||||
_m('Invalid login credentials.'));
|
||||
}
|
||||
|
||||
return $user;
|
||||
|
|
7
src/Util/Exception/EmailNotFoundException.php
Normal file
7
src/Util/Exception/EmailNotFoundException.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace App\Util\Exception;
|
||||
|
||||
class EmailNotFoundException extends EmailException {
|
||||
// TODO: everything
|
||||
}
|
9
src/Util/Exception/NicknameNotFoundException.php
Normal file
9
src/Util/Exception/NicknameNotFoundException.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace App\Util\Exception;
|
||||
|
||||
use App\Util\Exception\NicknameException;
|
||||
|
||||
class NicknameNotFoundException extends NicknameException {
|
||||
// TODO: everything
|
||||
}
|
|
@ -14,12 +14,15 @@
|
|||
<legend class="section-form-legend">{{ "Login" | trans }}</legend>
|
||||
|
||||
{% if error %}
|
||||
<label class="alert alert-danger">
|
||||
{{ error.getMessage() }}
|
||||
</label>
|
||||
|
||||
<ul>
|
||||
{#<ul>
|
||||
{% for flashError in app.flashes('verify_email_error') %}
|
||||
<li class="alert alert-danger">{{ error.messageKey | trans(error.messageData, 'security') }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</ul>#}
|
||||
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -15,14 +15,13 @@
|
|||
<fieldset>
|
||||
<legend class="section-form-legend">{{ "Register" | trans }}</legend>
|
||||
|
||||
<ul>
|
||||
{% for flashError in app.flashes('verify_email_error') %}
|
||||
<li class="alert alert-danger" role="alert">{{ flashError }}</li>
|
||||
{% endfor %}
|
||||
{% for flashError in app.flashes('verify_nickname_error') %}
|
||||
<li class="alert alert-danger" role="alert">{{ flashError }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% for flashError in app.flashes('verify_email_error') %}
|
||||
<label class="alert alert-danger" role="alert">{{ flashError }}</label>
|
||||
{% endfor %}
|
||||
|
||||
{% for flashError in app.flashes('verify_nickname_error') %}
|
||||
<label class="alert alert-danger" role="alert">{{ flashError }}</label>
|
||||
{% endfor %}
|
||||
|
||||
{{ form_row(registration_form.nickname) }}
|
||||
{{ form_row(registration_form.email) }}
|
||||
|
|
Loading…
Reference in New Issue
Block a user