Reputation: 93
I am working with Atlassian's Crowd Data Center deployment and developing an automation script to reset user credentials. My goal is to set a temporary password that forces users to change it upon their next login. I’ve been utilizing the Python Crowd library for this purpose, and while it has worked well overall, I’ve found the documentation to be somewhat challenging to navigate.
I've attempted to use attributes to trigger a password change prompt, but this approach hasn't successfully enforced the password reset on the next login.
Simply asking users to update their passwords isn’t a viable option, as most, if not all, are unlikely to comply. Here is my code so far:
_CROWD = crowd.CrowdServer(_CROWD_URL, "crowd", _CROWD_APP_PASSWORD)
new_password = generate_random_password()
try:
success = _CROWD.change_password(_USERNAME, new_password)
if success:
print(f"Password for {_USERNAME} has been reset to: {new_password}")
# enforce password change on next login - not sure about this it doesn't seem to work??
response = _CROWD.set_user_attribute(
_USERNAME, attribute="requiresPasswordChange", value="true"
)
if response == True:
print(
"The user will be required to change the password on the next login."
)
else:
print(f"Failed to enforce password change: {str(response)}")
Any suggestions are welcome!
Thank you!
Upvotes: 0
Views: 20