Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-18439

Ability to modify the login page

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Won't Fix
    • Component/s: core
    • Labels:
    • Similar Issues:

      Description

      We need to display a bit of information (which set of credentials to use, who to contact for site/job support, etc). We currently display that on the "Default View", but it must be visible BEFORE the user is logged in.

      NOW we want to set Jenkins so any access requires a logged-in user. In that case, first access jumps to login page showing only Username, Password, and "remember me" boxes.

      We want to modify the login page without worry of our mods being wiped out by a Jenkins upgrade (and without mucking in .jar files). Perhaps just a way to specify a blob of HTML that login.jelly will display above the "Username" input box??

        Attachments

          Activity

          Hide
          hiran_chaudhuri Hiran Chaudhuri added a comment -

          I tested by first assigning all permissions (and saw anonymous users have access to the file), then removed one by one (from the right). Anonymous user had access until I finally removed the last tick.

          I tried again by assigning the "Overall/Read" privilege and it definitely is sufficient.

          Show
          hiran_chaudhuri Hiran Chaudhuri added a comment - I tested by first assigning all permissions (and saw anonymous users have access to the file), then removed one by one (from the right). Anonymous user had access until I finally removed the last tick. I tried again by assigning the "Overall/Read" privilege and it definitely is sufficient.
          Hide
          hiran_chaudhuri Hiran Chaudhuri added a comment -

          So what I created in the end is a file called "loginhint.js" that resides in $JENKINS_HOME/userContent. This file's content is this:
          {{window.onload = function () {
          if(window.location.href.indexOf("/login?from=") !== -1)

          { var hint=document.createTextNode("Hint: Use your XXXXXX credentials to login."); var node = document.getElementById("main-panel"); node.insertBefore(hint, node.firstChild); }

          }}}
          The URL of theme JS is set to /userContent/loginhint.js

          With that I get the message on the login screen however can no longer load the config page? Seems like there is still something missing...

          Show
          hiran_chaudhuri Hiran Chaudhuri added a comment - So what I created in the end is a file called "loginhint.js" that resides in $JENKINS_HOME/userContent. This file's content is this: {{window.onload = function () { if(window.location.href.indexOf("/login?from=") !== -1) { var hint=document.createTextNode("Hint: Use your XXXXXX credentials to login."); var node = document.getElementById("main-panel"); node.insertBefore(hint, node.firstChild); } }}} The URL of theme JS is set to /userContent/loginhint.js With that I get the message on the login screen however can no longer load the config page? Seems like there is still something missing...
          Hide
          jwelch Jessica Welch added a comment -

          Hi Hiran - did you figure it a solution? I stumbled upon this while also adding links to the login page. Change "window.onload = function" to "document.addEventListener('DOMContentLoaded', function() { " Then the config page will load.

          Show
          jwelch Jessica Welch added a comment - Hi Hiran - did you figure it a solution? I stumbled upon this while also adding links to the login page. Change "window.onload = function" to "document.addEventListener('DOMContentLoaded', function() { " Then the config page will load.
          Hide
          hiran_chaudhuri Hiran Chaudhuri added a comment - - edited

          Hello Jessica.

          I tried your suggestion and it works for me. Thank you for the hint.
          Maybe that should go somewhere into documentation as others may want it as well.

          Hiran

          Show
          hiran_chaudhuri Hiran Chaudhuri added a comment - - edited Hello Jessica. I tried your suggestion and it works for me. Thank you for the hint. Maybe that should go somewhere into documentation as others may want it as well. Hiran
          Hide
          jwelch Jessica Welch added a comment -

          yay! glad to help

          Show
          jwelch Jessica Welch added a comment - yay! glad to help

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            m_broida m_broida
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: