[TASK] Add HTML5 checks for "create new admin user" in Install Tool 72/54872/5
authorJonathan IROULIN <joniroutypo3@gmail.com>
Wed, 29 Nov 2017 17:45:04 +0000 (18:45 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Wed, 29 Nov 2017 20:43:05 +0000 (21:43 +0100)
This patch adds HTML5 attributes to the form fields so the username
field is set to required and the password has to be at least 8
characters long.

Resolves: #82135
Releases: master
Change-Id: I3ab05af63125479de2427a5b236f8c434d598aad
Reviewed-on: https://review.typo3.org/54872
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/install/Resources/Private/Partials/Maintenance/CreateAdmin.html
typo3/sysext/install/Resources/Public/JavaScript/Modules/CreateAdmin.js

index 267a58a..a32477f 100644 (file)
@@ -8,7 +8,8 @@
 
 
 
-<div class="form-horizontal">
+<form action="" id="t3js-createAdmin-form" method="post">
+       <div class="form-horizontal">
        <div class="form-group">
                <label for="t3-install-admin-username" class="col-sm-3 control-label">Username:</label>
                <div class="col-sm-9">
@@ -17,6 +18,7 @@
                                class="t3-install-form-input-text t3js-createAdmin-user form-control"
                                type="text"
                                autocomplete="off"
+                               required
                        />
                </div>
        </div>
                                class="t3-install-form-input-text t3-install-form-password-strength t3js-createAdmin-password form-control"
                                type="password"
                                autocomplete="off"
+                               required
+                               minlength=8
+                               pattern=".{8,}"
+                               title="Password must be at least eight characters long."
                        />
                </div>
        </div>
@@ -39,6 +45,9 @@
                                class="t3-install-form-input-text t3js-createAdmin-password-check form-control"
                                type="password"
                                autocomplete="off"
+                               required
+                               minlength=8
+                               pattern=".{8,}"
                        />
                </div>
        </div>
@@ -48,7 +57,8 @@
 
 <button
        class="btn btn-default t3js-createAdmin-create"
-       type="button"
+       type="submit"
 >
        Create administrator user
 </button>
+</form>
index eb12eb4..479b284 100644 (file)
@@ -26,13 +26,14 @@ define([
        'use strict';
 
        return {
+               selectorCreateForm: '#t3js-createAdmin-form',
                selectorCreateToken: '#t3js-createAdmin-token',
                selectorCreateTrigger: '.t3js-createAdmin-create',
                selectorOutputContainer: '.t3js-createAdmin-output',
 
                initialize: function() {
                        var self = this;
-                       $(document).on('click', this.selectorCreateTrigger, function(e) {
+                       $(document).on('submit', this.selectorCreateForm, function(e) {
                                e.preventDefault();
                                self.create();
                        });