Alpha Video Training
Results 1 to 2 of 2

Thread: Integrate Persistent Login Into Existing Login

  1. #1
    Real Name
    Join Date
    Oct 2011

    Default Integrate Persistent Login Into Existing Login

    I have an existing Login UX Component that I want to integrate persistent login functionality into. This Login UX Component has an embedded Main UX component (main app). I took the persistent login template and tried to copy what was in it to my existing login component. What I copied was the Xbasic function code, Server-side event called "canAjaxCallback", and Client-side event called "onRenderComplete". I guess it isnt as easy as just copying this code into my existing login component! When I login, a message saids, "Login has expired, please login again" however it does login and I can see my Main Application. However, within my main application, a couple of List Controls are not filtering correctly, I assume because the session variable is not being set correctly now when the user logs in. Also, when I try to logout for persistent login by calling the logout function, nothing really happens. What should happen is when a user logs out, they should go back to the main login UX component, to the login panel card. Any ideas of what I need to do to integrate persistent login into an existing login component?

  2. #2
    Real Name
    Simone Baring-Gould
    Join Date
    Mar 2009
    Boulder, Colorado

    Default Re: Integrate Persistent Login Into Existing Login

    Hi Steven,

    I am also working on getting the persistent login template to work with an embedded component. I think I have gotten all of it to work except for session variables. Here is what I did (also see the attached xara picture that I made to try and understand what's going on):

    I did the reverse of what you did: I replaced my login component with the persistent template and then moved stuff from my old login component back to the new one (mostly the layout and something I had in one of the events).

    It is important that "Has integrated login functionality" is unchecked.

    I embedded my application UX and checked "Delay render is visible". Without this one gets an infinite loop. I set the security for the embedded UX to "always allowed". Otherwise, there are cases where one gets an infinite loop. (If the token is still good but the session has timed out, the onRenderComplete event redirects to the application panel which causes the embedded application component to be loaded, which causes a redirect to the login page, which causes the onRenderComplete event to fire -> infinite loop.)

    I moved the xbLogout callback function into the embedded component where my logout button lives and adjusted it:

    function xbLogout as c (e as p)
    'log the user out of the Alpha Anywhere security framework	
    dim jsOut as c 
    'Create the Javascript response to send to the client. The Javascript must:
    'return focus to the login panel
    'delete the token from localStorage
    'delete the token from the UX state object so that it does not get sent to server on subsequent Ajax callbacks
    'SBG: xbLogout is called from the embedded UX sw_medium and not from the login UX as in the persistent 
    'login example component. I therefore had to adjust the code to use a pointer to the parent UX:
    'Here is the original code:
    'jsOut = "{dialog.object}.panelSetActive('PANEL_LOGIN');" + crlf()+\
    '"var key = '" + e.tmpl.guid + "';" + crlf()+\
    '"localStorage.setItem(key,''); " + crlf()+\
    '"delete {dialog.object}.stateInfo['token'];" 
    'xbLogout = jsOut
    'And here is the adjusted code:
    jsOut = "var p_loginux = {dialog.Object}.getParentObject();" + crlf()+\
    "p_loginux.panelSetActive('PANEL_LOGIN');" + crlf()+\
    "var key = p_loginux.componentGUID;" + crlf()+\
    "localStorage.setItem(key,''); " + crlf()+\
    "delete p_loginux.stateInfo['token'];" 
    xbLogout = jsOut
    end function
    I copied the code in the login component
    Attached Images Attached Images

Similar Threads

  1. Mobile Persistent Login
    By scrimej in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 09-03-2017, 03:40 PM
  2. Persistent Login with PhoneGap
    By carlbsmith in forum Mobile & Browser Applications
    Replies: 3
    Last Post: 08-24-2017, 04:21 PM
  3. Token not generating for persistent login
    By carlbsmith in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 08-09-2017, 06:32 PM
  4. Persistent Login with Security Groups
    By jcarnevali in forum Mobile & Browser Applications
    Replies: 4
    Last Post: 07-12-2017, 06:51 PM
  5. how to integrate login using social media as an alternative
    By eduduru in forum Mobile & Browser Applications
    Replies: 1
    Last Post: 08-12-2016, 09:35 AM


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts