You are viewing limited content. For full access, please sign in.

Question

Question

LFDS SDK development: how to programmatically set a new DS user MUST change their password upon first login?

asked on February 1, 2024 Show version history

Hello, I am using LFDS SDK/API to create Directory Server user via code (workflow/standalone). 

I was able to create user/assign initial password/assign group without issue. However I am wondering what is the proper way of letting the new user to change their password upon first login?  This can be achieved via DS web GUI and tick "User must change password at next sign-in".

 

My code when create the user like this (in C#)

 

                LaserficheUser lfUser = LaserficheUser.Create(lmoDB);
                lfUser.Name = username;
                lfUser.Password = password;
                lfUser.ContainerID = lmoDB.GetRootContainer().ID;  // Set their organization to Root
                if (true)
                {
                    lfUser.PasswordUsesLeft = 0; 
                    lfUser.IgnorePasswordExpiration = true;
                }

                Guid participantLicense = new Guid("{22b871ca-e458-162d-43a5-a55153c40339}");
                lfUser.Licenses = new Guid[] { participantLicense };

                lfUser.Register();

Can anyone point me out what property/member variable should I set?  Thanks.

 

 

 

0 0

Replies

replied on February 1, 2024

Update:  after some more practice/test, the conclusion is I can't set policy at the  time of create the user. But by set these afterwards will work.

 

                LaserficheUser lfUser = (LaserficheUser)GetUser(lmoDB, username);

                lfUser.PasswordUsesLeft = 0;  // this will trigger password change
                lfUser.IgnorePasswordExpiration = true;  //ignore flag will be set 

                lfUser.Update();

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.