0

I don't want the password field to be a required user registration field. How can I remove the password field? Is this done by changes in user.module file?

1

Just Enable "Require e-mail verification when a visitor creates an account." in "admin/config/people/accounts" page. That will remove password fields and provide you extra security also ..

enter image description here

  • how to remove password field from user login form? I want, user must be login by its username only. No password required. – Kapil Singhal Mar 20 '14 at 9:50
  • An user account is protected by password always.. Without password User X can login to User Y account... Your above question doesn't makes sense.. I am afraid you cannot do that due to security implications and drupal doesn't allow that :-) – Anil Sagar Mar 20 '14 at 9:52
  • If i put a validation that a username will not be used twice, then may i achieve this??? – Kapil Singhal Mar 20 '14 at 9:53
  • Username is always unique in Drupal... The problem you need to address is how you can authenticate into the system.. Usernames are displayed in the site in various pages.. For Example when user create content or comments his username is displayed.. Most importantly in drupal super username is admin.. So if you take only username while logging in .. i can input admin as username and gain access to Drupal Portal and do what ever i want.. – Anil Sagar Mar 20 '14 at 9:55
  • one more question. I am using generate password module, by this i am able to register without password and in user.module, i made some changes and email id filed is also not required. after that as i register using only username and trying to login with only username, it showing password field is required. – Kapil Singhal Mar 20 '14 at 10:06
1

You can use Generate Password module to achieve this goal. This module makes the password field optional (or hidden) on the add new user page (admin & registration). If the password field is not set during registration, the system will generate a password. You can optionally display this password at the time it's created.

For more info go through the documentation of this module.

0

You need to write form_alter

 function MODULE_form_alter($form, &$form_state, $form_id){
    if ($form_id == "user_register_form") {
          $form['account']['pass']['#access']  = FALSE;

    }       
    return $form;
 }

in your form_submit you can not save blank password in DB so while saving create one temporary password

        $password = user_password(8);

and pass it in user_save. You may also need to alter the validation hook.

Hope this will help you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.