Skip to Content
Author's profile photo Pinaki Patra

Changing Hana Default Login Screen

Update Link is no more active

Assigned Tags

      14 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Stefanus Zhang
      Stefanus Zhang

      Hi there,

      I think this is a good first approach, I have copied it out and change the login form.

      However I have not found a way to redirect the user to my login page yet, since sap could just wipe sap package at any time to update their stuff, I don't think this is a good idea?

      If anyone found a setting somewhere that I can set to point to another package for login that will be great!

      Author's profile photo Pinaki Patra
      Pinaki Patra
      Blog Post Author

      Hi Stefanus,

      If you want to redirect the user to custom login page there is another way out.

      We can first look at how sap checks for the user login.

      1.Ajax call to chjeck if the user is already logged in (CRSF Token)

      2.If not redirect to the login page and create token

      (The code can be found at the ui/app.controller page)

      The same thing we can re-write on the on init event of our application controller . Then redirect the user for login to a custom .html login page with the target location as parameters.

      On successful login you can redirect back.

      Both the cases you have to set the authentation type to null in .xsaccess file as you will  be manually handling it.

      Author's profile photo Stefanus Zhang
      Stefanus Zhang

      Hi Pinaki Patra

      Thank you for the reply. Below is a piece of code for checking the session from app controller. 

      I change the else statement to a URLHelper redirect. However when going to the landing page, it seems it will load the original login form before redirecting it to mine. Is there a better way of doing this?

      Many thanks, I appreciate it!

        

      checkSession: function() {

              var view = this.getView();

              var origin = this.getParameterByName("x-sap-origin-location");

              $.ajax({

                  url: "/sap/hana/xs/formLogin/checkSession.xsjs",

                  type: "GET",

                  data: origin !== null ? {

                      "x-sap-origin-location": decodeURIComponent(origin)

                  } : {},

                  success: function(resp) {

                      if (resp) {

                          if (resp["x-sap-origin-location-ok"] === false) {

                              app.to("ui.phishing.page");

                              return;

                          }

                          if (resp.login === true) {

                              view.getController().handleSuccessfulLogin(resp);

                          } else {

       

                          sap.m.URLHelper.redirect("MYLINK_HERE?x-sap-origin-location="+origin, false);

                          }

                      }

                  }

              });

          }

      Author's profile photo Pinaki Patra
      Pinaki Patra
      Blog Post Author

      Hi Stefanus,

      I think if you can write the same piece of code in your ui5 application controller :  function onInit Event and then redirect to your custom login page.

      You have to set the security type to null in the .xsapp of your ui5 appilcation.

      Author's profile photo Stefanus Zhang
      Stefanus Zhang

      hello Pinaki Patra,

      I tried that, its the same thing. I suppose it is because we are handling the login page from the front end. That is why, no matter what, it will load the original login page before redirecting it to my login page.

      I'm surprised that we can't define this setting in xsengine.ini file or in some other file. So that the backend able to tell straight away which package to load.

      Yeah .xsaccess file is set to null since we want it to be accessible publicly. I have done that part.

      Author's profile photo Former Member
      Former Member

      Hi Pinaki,

      We have followed the steps that are specified in the above document, but while changing any code in resource file to change the text on the Logon screen and running the application it is displaying logon page as a blank page.

      Kindly suggest how the application to be run once the changes are done in the standard HANA logon screen.

      As this is a priority for us, your prior response is appreciated. Thanks in advance.

      Thanks and Regards,

      Prasad.

      Author's profile photo Pinaki Patra
      Pinaki Patra
      Blog Post Author

      Hi,

      Can you please share the code(changed)

      Author's profile photo Srishti Gupta
      Srishti Gupta

      Hi Pinaki,

      I have followed the steps that are specified in the above document but the question arises for me is:

      How to use default logon with custom login table that consists of custom users and their password.

      As this is a required to me for my application, your prior response is appreciated. Thanks in advance.

      Thanks and Regards,

      Srishti

      Author's profile photo Pinaki Patra
      Pinaki Patra
      Blog Post Author

      So what you are telling is that the users in your table are not database users.

      In that case I am not sure about the possibility.

      I am not sure but i think the alternate solution would be to create hana restricted users  and maintain a log of that in your table.

      Thay way you can make good use of the hana authentecation  layer without much effort

      Author's profile photo Srishti Gupta
      Srishti Gupta

      Hi Pinaki


      I leverage the platform to get the user to login. Now, I've implemented the login in my app.

      But right now, I'm getting a little bit issue in implementing API for hotel on basis of location entered by user.


      Using Google API, I'm getting an error in the key generated i.e.


      <script   async defer src="https://maps.googleapis.com/maps/api/jsv=3&key=AIzaSyCuiF_qkAS3B966HlA9yhf4vOQiKxBcE48" &libraries=places &callback=initMap>

      </script>

      Could you suggest which API I could use..Google API or Some other API of hotel which provides open access to its database of hotel ?


      Thanks for any help.

      Author's profile photo Pinaki Patra
      Pinaki Patra
      Blog Post Author

      Hi ,

      Try clear trip for public API.

      Its simple to use . . . . slight issue in  reliability.

      Author's profile photo Srishti Gupta
      Srishti Gupta

      But on Cleartrip there are no steps given to access API. I'm facing a little trouble in accessing and customizing the API.

      Could you provide me the link to access its API.

      Author's profile photo Pinaki Patra
      Pinaki Patra
      Blog Post Author

      Hi , I would recommend you start a new discussion for he same.

      The clear-trip API is a public API and you can debug their website to view the api's used.

      Author's profile photo Robert James Camangon
      Robert James Camangon

      Hi,

      Currently, we use SAML SSO to our SAP HANA XS with our ADFS. Is it possible to redirect to a logon page if user has no access to ADFS but has access in SAP HANA? If it is possible, can you please help me on how to do it?

      Thanks a lot.

      Robert