Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×We Have a request in our JIRA service desk portal for users to reset thier Captcha when they have locked themselves out of the tool. (this typically happens when account passwords have changed and automation has not been updated). To day this is manual process that we are looking to automate.
We would like to create a script for allowing users to reset thier capcha for JIRA, Confluence and Bitbucket. does anyone know if this is possible via the API Calls? I could not find the API calls on developer.atlassian.com
This may seem an odd question, but if you're going to let users disable their own CAPTCHA, why not just turn it off?
That said, I'm pretty sure that you can use the LoginManager for this.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.security.login.LoginManager def loginManager = ComponentAccessor.getComponent(LoginManager) loginManager.resetFailedLoginCount(user)
You'll need to set the user variable according to some logic -- obviously you don't want to get the logged in user! You could get the user via the userManager, like...
def user = ComponentAccessor.userManager.getUserByName("username")
How to set the username string will depend on the context you're working in (REST Endpoint, Workflow Function, etc.).
Since we use an identity provider, the user does not have access to the Atalssian login screens and need an alternative method to reset captcha.
therefore, we want to create an automated script to reset captcha that a unloack a user when a ticket is submittd.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the above code but its seems its throwing error.
This is what tried:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.security.login.LoginManager def user = ComponentAccessor.userManager.getUserByName("wtuscan") def loginManager = ComponentAccessor.getComponent(LoginManager) loginManager.resetFailedLoginCount(user)
Result:
Error No signature of method: com.atlassian.jira.security.login.LoginManagerImpl.resetFailedLoginCount() is applicable for argument types: (com.atlassian.jira.user.DelegatingApplicationUser) values: [wtuscan(wtuscan)] Possible solutions: resetFailedLoginCount(com.atlassian.crowd.embedded.api.User) groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.security.login.LoginManagerImpl.resetFailedLoginCount() is applicable for argument types: (com.atlassian.jira.user.DelegatingApplicationUser) values: [wtuscan(wtuscan)] Possible solutions: resetFailedLoginCount(com.atlassian.crowd.embedded.api.User) at Script18.run(Script18.groovy:5)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am trying to figure this out as well, were you able to resolve these errors?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey guys,
In which version of JIRA you are ? Jonny's answer is the right way in JIRa 7.
From your error Abyakta ot seems you are in a JIRA v6.*
regards, Thanos.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Jonny, this worked in Jira 8.13 in scriptrunner.
Add usernames to the list of strings.
loop checks each user and resets failed count if > 0.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.login.LoginManager
import com.atlassian.jira.bc.security.login.LoginInfoImpl
def loginManager = ComponentAccessor.getComponent(LoginManager)
List<String> users = ["username1", "username2", "username3"]
users.each{ val ->
def user = ComponentAccessor.userManager.getUserByName(val)
if (user != null){
def userLoginInfo = loginManager.getLoginInfo(val)
if(userLoginInfo.getCurrentFailedLoginCount() > 0) {
log.info("reseting failed count for " + val)
loginManager.resetFailedLoginCount(user)
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.