The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a banner to just the login screen using ScriptRunner

Kira Graf
Contributor
October 15, 2019

We've switched to SSO and wanted to add a message to the login screen telling them to contact an Admin if they see that screen. I am the JIRA administrator but don't have access to the JIRA server to edit pages so I had to figure out a way to do it through scriptrunner.

I added a web panel but the problem was that the many of the webpanel locations are not displayed on the login page so I had to add a banner a the top of the page but only display it for the login screen. So if you are in the same boat, here's how to do it for Jira v7.

  • Admin -> Add Ons -> Script Fragment
  • Add New Item -> Show a Web Panel
  • Location: atl.header
  • Condition: 
import com.atlassian.jira.plugin.webfragment.model.JiraHelper

JiraHelper jirahelper = new JiraHelper();
def url = jiraHelper.getRequest().getRequestURL().toString();

if (url.contains('login')) {
return 1
} else {
return 0
}
  •  Provider class/script:
writer.write("<div style='background-color: yellow; text-align: center'>" +
"If you are trying to access this page please contact your systems administrator. </div>")

 

Hope that helps!

Kira

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
SvenF
Contributor
March 17, 2025

very late at this party, but this will work:

import com.atlassian.jira.component.ComponentAccessor

if (!ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser())
{ return true }
0 votes
Jose Ramirez
Contributor
March 5, 2024

Is there a confluence version of this ? 

0 votes
Jeffrey Rodriguez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 13, 2020

This is exactly what I need. I gave this a try, but I'm not seeing anything on my login page. After saving the fragment, did you have to take any additional action for this to display on the login page?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events