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:
Andy Miller
2015-12-10 12:12:04 -07:00
2 changed files with 4 additions and 20 deletions

View File

@@ -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 = [

View File

@@ -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