When Twitter Signin submodule has been configured to create accounts automatically, it does not show the generated password, so the user is logged in but he cannot reset its password.

CommentFileSizeAuthor
#3 twitter_signin-fix_password-1614494-3.patch994 bytesspesic
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

juampynr’s picture

Version: 7.x-3.x-dev » 6.x-3.x-dev
juampynr’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev

Still failing. Further feedback at #1647982: Automatically created accounts still cannot change their password. Let's continue in this issue.

spesic’s picture

Patch repost from the duplicate issue posted above.

marcvangend’s picture

As I workaround, I implemented this hook_form_alter function:

function hook_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'user_profile_form' && $form['#user_category'] == 'account') {
    // Users logged in via Facebook or Twitter have no email address registered
    // in Drupal and do not know their own password. Allow them to to add their
    // email address without validating the current password. 
    if (empty($form['#user']->mail) && isset($form['account']['current_pass'])) {
      $form['account']['current_pass']['#type'] = 'value';
      if (($key = array_search('user_validate_current_pass', $form['#validate'])) !== false) {
        unset($form['#validate'][$key]);
      }
    }
  }
}

This form alter removes the 'current password' field and its validation in case a user has no email address set. It may not be the perfect solution for every site with a similar problem, but I hope it helps someone.

Leeteq’s picture

Priority: Normal » Major
dddave’s picture

Status: Active » Closed (won't fix)

I guess this can be won't fixed as this branch is no longer supported.