AnsweredAssumed Answered

Modifying Login to change error message

Question asked by jlaramie9 on Sep 27, 2013
Latest reply on Nov 11, 2016 by yroopa1229@gmail.com
I've been working with Alfresco Community adapting it to my company needs for a couple months with the help of a lot of great information from this forum but I've hit a wall.  We are looking to show specific error messages on the login page when a user has not been successful.  I copied the LoginPost class and have been able to catch the bubbled up error message I want to display.  With some server side logging of the response being written I verified the JSON data has the new error message set in the data as "message" and here it is:

{
    "status" :
  {
    "code" : 403,
    "name" : "Forbidden",
    "description" : "Server understood the request but refused to fulfill it."
  }, 
 
  "message" : "08270001 Invalid Credentials", 
  "exception" : "",
 
  "callstack" :
  [
       
  ],
 
  "server" : "Community v4.2.0 (4576) schema 6,022",
  "time" : "Sep 27, 2013 10:57:01 AM"
}

I tried accessing it in the ftl as {message}, I tried making it a argument to the login.get.js by editing slingshot-login.xml and changing the properties from

      <!– Login form –>
      <component>
         <region-id>components</region-id>
         <url>/components/guest/login</url>
         <properties>
            <error>{error}</error>
         </properties>
      </component>

   </components>
to
      <!– Login form –>
      <component>
         <region-id>components</region-id>
         <url>/components/guest/login</url>
         <properties>
            <error>{error}</error>
            <errorDisplay>{message}</errorDisplay>
         </properties>
      </component>

   </components>

I even tried {data.message} as another programmer suggested that "most" JSON developers call the JSON string used as a parameter to the function as data.  I also tried to pass the data into the page via the Map returned by the executeImpl method but to no avail.  My gut says that it has to do with the error status that is set but don't know.  Any ideas, I'm left scratching my head???

Thanks for any help,

Jim

Outcomes