gitlabhq/gitlabhq — pull request #7681 by duk3luk3 (2014-09-03 14:39:49+00:00)
Title: Extend user add api to allow adding users like from admin panel

- Add force_random_password parameter to have password of new user set
randomly and expired
- Update docs
- Update tests

This is a remake of my [old PR](https://github.com/gitlabhq/gitlabhq/pull/4805) that was abandoned since things about how user registration/signup works were expected to change soon. Since it's been a year and the PR is still applicable, I'm resubmitting it. I've heavily polished and simplified it.

It simply adds a new parameter to the /users POST api call that allows to trigger identical behaviour to adding users from the admin panel: Setting the newly signed up user as already confirmed and with an expired password, resulting in a "You have been added to Gitlab, click here to set a password" email.

As a bonus, I've also fixed two tests for that API call that were succeeding for the wrong reasons.