I know that my Drupal installation (9.3.15) doesn't trim spaces at the login page (form id: user-login-form).
I have some code in the HOOK_form_user_login_form_alter
but in that place in $form_state
I don't have any ->getValue('%field%')
, it returns NULL.
Also I can not modify '$form['name']['#value']' because it is empty in that context.
How do I trim spaces on the user's input? I can do $form_state->getUserInput();
and I can see what the user has entered but I don't know how to modify it. Because $form_alter is an object.