Skip to content
Snippets Groups Projects
Commit c15ee4ba authored by André Noack's avatar André Noack
Browse files

Resolve "autocomplete im Registrierungsformular"

Closes #3705

Merge request studip/studip!2577
parent 6b7b04e0
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,9 @@ class RegistrationController extends AuthenticatedController
public function index_action()
{
$new_user = new User();
$new_user->perms = 'user';
$new_user->auth_plugin = 'standard';
$new_user->preferred_language = $_SESSION['_language'] ?? Config::get()->DEFAULT_LANGUAGE;
$this->registrationform = Form::fromSORM(
$new_user,
[
......@@ -26,6 +28,7 @@ class RegistrationController extends AuthenticatedController
'label' => _('Benutzername'),
'required' => true,
'maxlength' => '63',
'attributes' => ['autocomplete' => 'off'],
'validate' => function ($value, $input) {
if (!preg_match(Config::get()->USERNAME_REGULAR_EXPRESSION, $value)) {
return Config::get()->getMetadata('USERNAME_REGULAR_EXPRESSION')['comment'] ?:
......@@ -46,6 +49,7 @@ class RegistrationController extends AuthenticatedController
'required' => true,
'maxlength' => '31',
'minlength' => '8',
'attributes' => ['autocomplete' => 'new-password'],
'mapper' => function($value) {
$hasher = UserManagement::getPwdHasher();
return $hasher->HashPassword($value);
......@@ -57,6 +61,7 @@ class RegistrationController extends AuthenticatedController
'required' => true,
'maxlength' => '31',
'minlength' => '8',
'attributes' => ['autocomplete' => 'new-password'],
':pattern' => "password.replace(/[.*+?^\${}()|[\\]\\\\]/g, '\\\\$&')", //mask special chars
'data-validation_requirement' => _('Passwörter stimmen nicht überein.'),
'store' => function() {}
......@@ -64,23 +69,28 @@ class RegistrationController extends AuthenticatedController
'title_front' => [
'label' => _('Titel'),
'type' => 'datalist',
'attributes' => ['autocomplete' => 'honorific-prefix'],
'options' => $GLOBALS['TITLE_FRONT_TEMPLATE']
],
'title_rear' => [
'label' => _('Titel nachgestellt'),
'type' => 'datalist',
'attributes' => ['autocomplete' => 'honorific-suffix'],
'options' => $GLOBALS['TITLE_REAR_TEMPLATE'],
],
'vorname' => [
'label' => _('Vorname'),
'attributes' => ['autocomplete' => 'given-name'],
'required' => true
],
'nachname' => [
'label' => _('Nachname'),
'attributes' => ['autocomplete' => 'family-name'],
'required' => true
],
'geschlecht' => [
'name' => 'geschlecht',
'value' => 0,
'label' => _('Geschlecht'),
'type' => 'radio',
'orientation' => 'horizontal',
......@@ -94,6 +104,7 @@ class RegistrationController extends AuthenticatedController
'email' => [
'label' => _('E-Mail'),
'required' => true,
'attributes' => ['autocomplete' => 'email'],
'validate' => function ($value, $input) {
$user = User::findOneByEmail($value);
$context = $input->getContextObject();
......
......@@ -6,10 +6,15 @@
<? if ($this->required) : ?>
<span class="asterisk" title="<?= _('Dies ist ein Pflichtfeld') ?>" aria-hidden="true">*</span>
<? endif ?>
<input type="text" list="<?= $this->title ?>" id="" v-model="<?= htmlReady($this->name) ?>" <?= $this->required ? 'required aria-required="true"' : '' ?> />
<datalist class="" id="<?= $this->title ?>" <?= $attributes ?>>
<input type="text"
list="<?= htmlReady($this->title) ?>"
v-model="<?= htmlReady($this->name) ?>"
name="<?= htmlReady($this->name) ?>"
value="<?= htmlReady($this->value) ?>"
id="<?= htmlReady($id) ?>"
<?= $this->required ? 'required aria-required="true"' : '' ?>
<?= $attributes ?>>
<datalist class="" id="<?= htmlReady($this->title) ?>">
<? foreach ($options as $key => $option) : ?>
<option value="<?= htmlReady($option) ?>"<?= ($option == $value ? " selected" : "") ?>>
</option>
......
<div class="formpart">
<section <?= $this->orientation == 'horizontal' ? 'class="hgroup"' : '' ?> for="<?= $id ?>">
<section <?= $this->orientation == 'horizontal' ? 'class="hgroup"' : '' ?> id="<?= htmlReady($id) ?>">
<span class="textlabel">
<?= htmlReady($this->title) ?>
</span>
......@@ -7,6 +7,7 @@
<? foreach ($options as $key => $option) : ?>
<label class="" <?= $attributes ?>>
<input type="radio"
name="<?= htmlReady($this->name) ?>"
v-model="<?= htmlReady($this->name) ?>"
value="<?= htmlReady($key) ?>" <?= $key == $value ? 'checked' : '' ?>>
<?= htmlReady($option) ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment