cancel
Showing results for 
Search instead for 
Did you mean: 

Creating user and password in webdynpro for java

Former Member
0 Kudos

Hi All,

Is it possible to generate the password for the portal user created through code?

Note: Portal user is also created through wendynpro java code.

Regards,

V Karthi

Accepted Solutions (0)

Answers (4)

Answers (4)

siddharth_jain
Active Contributor
0 Kudos

Pls check the mention WIKI link and in setpasswordChangeRequired method formal parameter is boolean

siddharth_jain
Active Contributor
0 Kudos

Hi,

for setting up the initial password for the user you can call the below method,When the user will logon he has to change the password if password change required is true after setting the custom password.

void setPasswordChangeRequired(boolean chng)

Sets the PasswordChangeRequired attribute of the IUserAccount object.

Updated:

also i think that in EP 7.0 after setting the pass when the user will logon portal will automatically prompt for the new passward even if you are not calling the passwordChangeRequired method,try it.

Also check the following WIKI for EP user creation and amendment.

same code mentioned in the WIKI can be used in WD java with small modifications:

https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/createandeditEPuserwithJava+code

Rgds,

Siddharth

Edited by: Siddharth Jain on Jun 10, 2009 11:26 AM

Former Member
0 Kudos

Thank you siddarth,but where we are setting the initial password? this setchangepasswordrequired will ask for old password rite? how i''ll create that ?

And which one will be login id ? is firstname or lastname?

Regards,

V Karthi

srinivas_sistu
Active Contributor
0 Kudos

Hi,

Basic requirement of Change password is:

you should provide original password.

In any case with out providing original password if you are changing tha password, it is technically equlas to set a new password.

User's loggin doesn't always means first name or second name. If you have User Management tab available in portal, then search for any user, there you can see a field named Loggin Id. Technical name to access this parametre is IUser.getUniqueName().

Regards,

SrinivaS

srinivas_sistu
Active Contributor
0 Kudos

Hi,

yes you can change a user's password through WDJava.

Change Password:

try{

IUserFactory userfact = UMFactory.getUserFactory();

//get user id of the user to change the password

String userId = wdContext.currentLicenceUsersOutputVNElement().getUserid();

//get user object

IUser specifiedUser = userfact.getUserByLogonID(userId);

//get user maintance object

IUserMaint userMaint = userfact.getMutableUser(specifiedUser.getUniqueID());

//get user account

IUserAccount uacc = UMFactory.getUserAccountFactory().getUserAccountByLogonId(userId);

//create mutable user account

IUserAccount iuacc = UMFactory.getUserAccountFactory().getMutableUserAccount(uacc.getUniqueID());

iuacc.setPassword(wdContext.currentContextElement().getNewPassword());

iuacc.save();

iuacc.commit();

manager.reportSuccess("Password has been reset.");

}

catch (Exception e)

{

manager.reportException("error occured " + e , false);

e.printStackTrace();

}

Regards,

SrinivaS

Former Member
0 Kudos

Hi Srinivas,

Thank you for the sample code .But Sample which you gave is to change password .

can you tell, can we set the initial password throught the code?

Regards,

V Karthi

Former Member
0 Kudos

Hi Karthi,

Can you see the user that you have created in UME of Portal ?

If you can, then you should be able to generate intial password for this user too.

Thanks & Regards,

Vipin.