mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-15 01:36:08 +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 = [];
|
$data = [];
|
||||||
$username = $form->value('username');
|
$username = $form->value('username');
|
||||||
|
|
||||||
if (!$this->validate('username_format', $username)) {
|
if ($form->value('password1') != $form->value('password2')) {
|
||||||
$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'))) {
|
|
||||||
$this->grav->fireEvent('onFormValidationError',
|
$this->grav->fireEvent('onFormValidationError',
|
||||||
new Event([
|
new Event([
|
||||||
'form' => $form,
|
'form' => $form,
|
||||||
@@ -206,6 +187,7 @@ class AdminPlugin extends Plugin
|
|||||||
$event->stopPropagation();
|
$event->stopPropagation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['password'] = $form->value('password1');
|
$data['password'] = $form->value('password1');
|
||||||
|
|
||||||
$fields = [
|
$fields = [
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ form:
|
|||||||
placeholder: PLUGIN_ADMIN.USERNAME
|
placeholder: PLUGIN_ADMIN.USERNAME
|
||||||
validate:
|
validate:
|
||||||
required: true
|
required: true
|
||||||
|
message: PLUGIN_LOGIN.USERNAME_NOT_VALID
|
||||||
|
pattern: '^[a-z0-9_-]{3,16}$'
|
||||||
|
|
||||||
- name: email
|
- name: email
|
||||||
type: text
|
type: text
|
||||||
|
|||||||
Reference in New Issue
Block a user