Change Password in Jira 5.0

I have one requirement that I want to change the user password on the fly on Jira 5.0. Please let me know piece of code (API) to achieve this functionality. Its very urgent for our deployment. Please help.

1 answer

1 accepted

0 vote

You can use the updateUser method. validateUpdateUser will return error if you don't have permission to modify the password.

http://docs.atlassian.com/jira/latest/com/atlassian/jira/bc/user/UserService.html

Jobin, I have tried a lot but still not able to modify the password of an user. I tried by follwing way, please verify and let me the correct way to achive the functionality.

#1. I tried to use UserManager class to update an user (com.atlassian.crowd.embedded.api.User.updateUser()). But here User calss cant be intialized. I thought, I will create an User object with modify the password and update the user. But I failed to do this. Can you tell me how can i create an User object with modified password?

#2. I tried DefaultUserservice (com.atlassian.jira.bc.user.DefaultUserService) class to use updateUser() method, but i am not able to get this Class object and not able to send the parameter (UserService.UpdateUserValidationResult) for updateUser() method. Do you have any example piece of code to achive this functionality.

In jira 4.3 i used below piece of code to modify the password of an user.

userManager.getUser(quicklookID).setPassword(strPassword);

Please help me to modify an user password in Jira5.0.

Either inject UserService in the constructor or use ComponentAccessor.getComponent(UserService.class)

Also working by below code. Thanks for your quidance.

userUtil.changePassword(userManager.getUserObject(quicklookID), strPassword);

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Off-topic

Get to know our Atlassian User Group Leaders from Bengaluru, India

Meet @Dinesh Dhinakaran, @Vishnu Vasudeva, @Rajeev Verma, and Jamshid Nalakath: Our extraordinary AUG leaders from Bengaluru, India. These four work together to strengthen the bonds of their local co...

157 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you