Hi,

I have a problem with services, when I would like to login just after I register a user. I've got an error "Wrong username or password ...". When I modify the password in the admin, the problem doesn't appear. :/

I made that

var data = {
  "name": "test",
  "mail": "test@test.fr",
  "pass": "test",
  "status": 1
}

jQuery.ajax({
  type: "POST",
  url: "http://duppp.local/api/1.0/user/register",
  dataType: 'json',
  data: JSON.stringify(data),
  contentType: 'application/json',
  success: function(data) {
    console.log(data);
  },
  error: function(data) {
    console.log(data);
  }
});

Comments

ygerasimov’s picture

Category: bug » support
Status: Active » Fixed

Thanks for bringing this point out. The thing is if you are anonymous user and register a user your register form does not have password field at all. It has only username and email fields. All instructions are sent by email (with token to log in and set the password). So register call actually does not set the password.

I have cleaned up tests to remove passing password.

If you need to allow anonymous user to set their password during registration you need to use some contrib module. For example https://drupal.org/project/user_registrationpassword (but I haven't tested it).

atu’s picture

Thanks for your quick answer. I will try this module https://drupal.org/project/user_registrationpassword and I will tell you if it's working or not ;)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

mstrelan’s picture

Issue summary: View changes

What about when admins create new users, eg by logging in via OAuth2? We still have to user the user/register resource but the password is now cleared! Should I open a new issue?

justinen’s picture

mstrelan - I'm also having this issue with admins creating users. Did you create a new issue for this? I wasn't able to find it anywhere in the issue queue. I'm using version 7.x-3.7

mstrelan’s picture

No, I didn't create a new issue.

justinen’s picture

Do you have any suggestions for a fix/workaround? Thanks.

mstrelan’s picture

Actually I can't remember what I did since I didn't build the app, just the Drupal site. It was either resolved by using user_registrationpassword, or I may have told the developer to create the user then update it immediately after with the password submitted in the user creation/registration form.

justinen’s picture