Forum Discussion

Han's avatar
Han
Ace
7 years ago

Capture successful Log in and Registration

Hi all,

I would like to capture a successful log in and user registration.  Ideally I am looking for some kind of variable that after the forms were submitted I could know if the process was completed successfully.


Does anyone know if there is a variable or key in lithium I can use to retrieve this information? 

 

  • Han You could give the "activity" context object a try: https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=freemarker#l::{"p":"%2Frefer%2FcontextObjects","h":"%23activity"}

    It should allow you to "catch" registration events. Not sure what you define as "successful", if you mean that user.registration.complete == true, then I do not think that would happen immediately, as the user usually needs to confirm the email for that..., but some exemplary code might help anyways...

    <#if (!user.registration.complete)>
        <#-- do something if user didn't confirm email yet -->
    <#elseif (user.registered && user.registration.complete)>
        <#-- this one seems to be successfully registered -->
    <#elseif (user.anonymous)>
        <#-- this one is not logged in -->
    </#if>

     

4 Replies

  • Han You could give the "activity" context object a try: https://community.lithium.com/t5/Developer-Documentation/bd-p/dev-doc-portal?section=freemarker#l::{"p":"%2Frefer%2FcontextObjects","h":"%23activity"}

    It should allow you to "catch" registration events. Not sure what you define as "successful", if you mean that user.registration.complete == true, then I do not think that would happen immediately, as the user usually needs to confirm the email for that..., but some exemplary code might help anyways...

    <#if (!user.registration.complete)>
        <#-- do something if user didn't confirm email yet -->
    <#elseif (user.registered && user.registration.complete)>
        <#-- this one seems to be successfully registered -->
    <#elseif (user.anonymous)>
        <#-- this one is not logged in -->
    </#if>

     

  • Han's avatar
    Han
    Ace
    7 years ago

    Thanks luk, the activity context object was what I needed. 

  • Han's avatar
    Han
    Ace
    7 years ago

     

    I'm still having a little trouble with the sign off event, right now I am using:

      <#if activity.results.name.UserSignedOff??>
      </#if>

     

    However this seems to be triggering  at the same time as "UserSignedOn". Does anyone have any suggestions as to what I am missing? 

  • luk's avatar
    luk
    Boss
    7 years ago

    Hm, hard to tell as we cannot see under the hood (a.k.a. the underlying Java  code), so maybe DougS could tell more here?