this module will help you Encryption
Drupal - Validate form before submit / Encrypt password before send it
-
03-04-2022 - |
سؤال
I would like to modify (encrypt) the login password in Drupal, before it sends it decrypted to server. I didn't find any module to do that (validation before submission), and I couldn't find a way of validate the fields before they are sent to server.
Is there a way to solve it?
Thank you!
المحلول
نصائح أخرى
Create your custom module and use hook_form_alter to add a new custom validation and submission callbacks:
function YOUR_MODULE_form_alter(&$form, &$form_state, $form_id)
{
if($form_id == "user_profile_form") {
$form['#validate'][] = 'your_new_validation_callback';
$form['#submit'][] = 'your_new_submission_callback';
}
}
function your_new_validation_callback($form, &$form_state)
{
// add your validation logic
}
function your_new_submission_callback($form, &$form_state)
{
// add your submission logic
}
Hope this helps.
لا تنتمي إلى StackOverflow