Announcement

Collapse
No announcement yet.

Redirect to the previous page after Log-in

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Redirect to the previous page after Log-in

    Hi,

    Does any body know how to setup the app_Login Application, so that the secured page after Login can go back to the page before the login process?

    BTW, can I set up a page with "read only" for anonymous user without login?

    Thanks!
    Last edited by lovenix; 10-16-2014, 01:05 PM.

  • #2
    If you create a (global) variable where you store the name of the application calling the login then in the login you can do a sc_redir([glob_jumpbackto]); to go back.

    And yes you can set readonly, since you use the security model. It's a matter of setting a default user with no write rights.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Well - a bit of a long winded way is.....

      You would need to set up a small table with 2 fields - one field to hold the name of an app, the other to hold the user name (global var usr_login holds that value].

      And then in every app's onApplicationInit or onLoad event call a function that updates that table with it's own name and the current user name (create a library function once to do the work, and then just call it). That said, I'm not sure you can determine the current app's name (I'll let someone else chime in if it's possible). If it's not then you will need - at that point - for each app to set up it's own name and log that in the table - and you will need a separate table you create that has one field with your made up names and another field with the actual app name the made up name refers too.

      Assuming you have a menu app, then in that app's onApplicationInit add code to read the table and get the right app name for the current user and then issue an sc_redir(old_app_name.php);

      Of course, if you had to go the made up names route, then you will need to look up the real name for sc_redir to use.

      If you are not using a menu app then that last bit will need to go in the Login app's onValidateSuccess event.

      Comment


      • #4
        Albert that is true - but that global variable will not persist. I was assuming that lovenix wanted to return to the last page after logging off / ending the session.

        Of course I could be barking up the wrong tree.

        Comment


        • #5
          I don't know what you mean. I do it all the time. If I have a form which needs a few keys which are not present I use an address/return mechanism to jump to an application to retrieve a key, return to the requestion page etc. That works perfectly.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            Agreed - and that's all within the same login session.

            However, if (and a big if) you are at the end of your day and you are on a contacts app, say. You log off and go home. When you log in the next day it takes you straight back to the contacts app. That is what I thought lovenix meant - i.e. the reference to the last app you were on persisting between login sessions.

            If it is required to purely have a "placeholder" to allow a quick return to an app in the same login session - then yes, I agree - your suggestion is absolutely the way to go.

            Comment


            • #7
              Which proofs: the better the question, the better the answer ;-) Tnx, for explanation, I didn't think of that. In that case I would intercept the onexecute in the menu event to find out the latest function. To recover the latest situation (selected record etc) would be challenging. The record could have been changed, removed etc.
              Albert Drent
              aducom software netherlands
              scriptcase partner, reseller, support and (turn-key) development
              www.scriptcase.eu / www.scriptcase.nl

              Comment


              • #8
                Indeed! Still, 2 answers for the price of one :-)

                I didn't even want to think about record positioning if that was the case!

                Comment

                Working...
                X