Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case sensitive problem with upper letters by registration a new username #553

Open
hdietrich-timespin opened this issue Mar 12, 2024 · 0 comments

Comments

@hdietrich-timespin
Copy link

hdietrich-timespin commented Mar 12, 2024

There is a Problem with register a new username with upper Letters. The registration templates allow an upper letter input.

If you register upper letters in later edit in the typo3-backend, the username will transform upper letters to lower during saving and editing the inputfield.

Reason:

the column username is marked in typo3 core for lowercase ('eval' => 'nospace,trim,lower,uniqueInPid,required').

in /typo3/sysext/frontend/Configuration/TCA/fe_users.php

      'username' => [
            'label' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_tca.xlf:fe_users.username',
            'config' => [
                'type' => 'input',
                'size' => 20,
                'max' => 255,
                'eval' => 'nospace,trim,lower,uniqueInPid,required',
                'autocomplete' => false,
            ],
        ],

My Solution:

I register a JavaScript with the class “transform-value-to-lower-case”, which transform uppercase letters to lowercase letters:

<femanager:form.textfield
				id="femanager_field_username"
				property="username"
				class="form-control transform-value-to-lower-case"
				additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'username')}" />

main.js

jQuery(document).ready(function () {
    Main.init();
});


let Main = {
    init : function() {
        jQuery(".transform-value-to-lower-case").on('change keyup paste',this.inputTransformToLowerCase);
    },
    inputTransformToLowerCase: function(e){

        //preserving the position of the cursor
        var start = e.target.selectionStart;

        //Converting text to lowercase
        $(this).val($(this).val().toLowerCase());

        //Jumping back to the old position of the cursor
        e.target.selectionStart = e.target.selectionEnd = start;
    }
}

A better solution will be, if the Extension additionally check the "lower" in the "eval"-Key in the TCA-Config!

Please add my or other solution in the extension!

Thanks

@hdietrich-timespin hdietrich-timespin changed the title Problem with upper letters by registration a new username Case Sensitive Problem with upper letters by registration a new username Mar 12, 2024
@hdietrich-timespin hdietrich-timespin changed the title Case Sensitive Problem with upper letters by registration a new username Case sensitive problem with upper letters by registration a new username Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant