Looking at where I think the action happens, it's not a supprise the API 
behaves differently.
API:
lib/api/users.rb 
<https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/api/users.rb>

>From line "59: post do" admin access is ensured; required attributes are 
checked; user attributes are set and the user is saved, followd by some 
error handling.


UI:
app/controllers/admin/users_controller.rb 
<https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/controllers/admin/users_controller.rb#L41>

from line "41: def create" the user object is created (probably 
automagically filled with the form data) , the created_by_id attribute is 
set, then these lines follow:

    @user.generate_password    @user.generate_reset_token    
@user.skip_confirmation!


Causing a password to be generated and a password reset-mail to be sent out, 
(skip_confirmation is toggled??)


followed by @user.save and some feedback to the admin-role user.


I've tried adding the user actions like generate_reset_token in the API code. 
Resulting in only one mail being sent: "Account was created for you". But it 
does not contain the reset link.


So getting closer...


I am totally not familiar with Ruby, RoR and the GitLab code base ;-)  Anyone 
who would like to help?


Bests,


Bram



Op vrijdag 6 februari 2015 15:23:39 UTC+1 schreef Bram Daams:
>
> No. I'm creating accounts that do not exist in LDAP. My intention is to 
> create standard gitlab accounts for people not in our LDAP.
> Just to be sure weather LDAP interferes, I've disabled LDAP and this gives 
> the same result.
>
> Bests,
>
> Bram
>
> Op donderdag 5 februari 2015 21:56:33 UTC+1 schreef Daniel Serodio:
>>
>> If you're using LDAP, won't the user's password be the LDAP password?
>>
>> Regards,
>> Daniel Serodio
>>
>> On Wednesday, January 28, 2015 at 2:53:07 PM UTC-2, Bram Daams wrote:
>>>
>>> Hi,
>>>
>>> I'm setting up a registration script that uses the gitlab API to create 
>>> gitlab user accounts.
>>>
>>> When I POST the request with the required parameters (email, name, 
>>> username, password), two mails are sent:
>>>
>>> ========
>>> Subject: Confirmation instructions
>>> Body:
>>> Welcome Your name here!
>>>
>>> You can confirm your account through the link below:
>>>
>>> Confirm my account[1]
>>> ========
>>>
>>> Followed by:
>>>
>>> ========
>>> Subject: Account was created for you
>>> Body:
>>> Hi Your name here!
>>>
>>> The Administrator created an account for you. Now you are a member of 
>>> the company GitLab application.
>>>
>>> login.......................................... [email protected]
>>>
>>> —
>>> View it on GitLab[2]
>>> ========
>>>
>>>
>>> When John Doe in this example, follows the first confirmation link, 
>>> he'll see a
>>> flash message:
>>> "Your account was successfully confirmed. You are now signed in.""
>>>
>>> From there, he can't change his password. Because he doesn't know his 
>>> password.
>>>
>>> To get John to work with gitlab. He should:
>>>
>>>    - logout.
>>>    - Navigate to the standard login form (we have ldap enabled and that 
>>>    login form is displayed on top)
>>>    - click "Forgot your password?"
>>>    - fill in his mail address
>>>    - check mail
>>>    - click the "Change my password" link in the mail.
>>>    - Then he can set his password.
>>>
>>> This is quite a contrast compared to an account created by an admin user:
>>>
>>> Hit the "New User" button in the user overview
>>>
>>>    - fill in: name, username, email
>>>    - hit create user
>>>    - the user gets an email with subject: "Account was created for you"
>>>    - the mail contains a link set a password
>>>
>>> Ideally, you want to have the password field optional in the user create 
>>> api call. If the password is omitted, the newly create user should receive 
>>> just one mail, just like when done manually through the UI.
>>>
>>> Seems like a bug to me. All functionality seems to be thare, but it 
>>> looks like the wrong action is triggered.
>>> Am I doing something wrong here?
>>> Is there a work-around?
>>>
>>> Using the latest (7.7.1) omnibus install.
>>>
>>> Bests,
>>>
>>> Bram
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"GitLab" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/gitlabhq/e1eb344e-9903-4ead-8cd1-8ecadb397015%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to