mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-14 17:26:10 +01:00
Merge branch 'feature/admin_registration' of https://github.com/getgrav/grav-plugin-admin into feature/admin_registration
Conflicts: admin.php
This commit is contained in:
22
admin.php
22
admin.php
@@ -178,26 +178,7 @@ class AdminPlugin extends Plugin
|
||||
$data = [];
|
||||
$username = $form->value('username');
|
||||
|
||||
if (!$this->validate('username_format', $username)) {
|
||||
$this->grav->fireEvent('onFormValidationError',
|
||||
new Event([
|
||||
'form' => $form,
|
||||
'message' => $this->grav['language']->translate('PLUGIN_LOGIN.USERNAME_NOT_VALID')]));
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!$this->validate('password1', $form->value('password1'))) {
|
||||
$this->grav->fireEvent('onFormValidationError',
|
||||
new Event([
|
||||
'form' => $form,
|
||||
'message' => $this->grav['language']->translate('PLUGIN_LOGIN.PASSWORD_NOT_VALID')
|
||||
]));
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
}
|
||||
if (!$this->validate('password2', $form->value('password2'), $form->value('password1'))) {
|
||||
if ($form->value('password1') != $form->value('password2')) {
|
||||
$this->grav->fireEvent('onFormValidationError',
|
||||
new Event([
|
||||
'form' => $form,
|
||||
@@ -206,6 +187,7 @@ class AdminPlugin extends Plugin
|
||||
$event->stopPropagation();
|
||||
return;
|
||||
}
|
||||
|
||||
$data['password'] = $form->value('password1');
|
||||
|
||||
$fields = [
|
||||
|
||||
@@ -10,6 +10,8 @@ form:
|
||||
placeholder: PLUGIN_ADMIN.USERNAME
|
||||
validate:
|
||||
required: true
|
||||
message: PLUGIN_LOGIN.USERNAME_NOT_VALID
|
||||
pattern: '^[a-z0-9_-]{3,16}$'
|
||||
|
||||
- name: email
|
||||
type: text
|
||||
|
||||
Reference in New Issue
Block a user