I need to catch username/password using the hook_form_alter()
. I'm using this code:
function sds_form_alter(&$form, FormStateInterface $form_state, $form_id ) {
if (in_array($form_id, ['user_login_block_form', 'user_login_form'])) {
$username= $form_state->getValue('name');
echo "Username Value".$username;
}
}
but it returns null
. What am I missing here?