Secure Web Portals

Secure Web Portals are created by linking Pages to a Layout that forces authentication through the use of @BRT Login Helpers.

At minimum, the Layout requires the Helpers:

  • @BRT.UserRecord()
  • @BRT.LoginForm( )
  • @BRT.Logout()

It should also include @BRT.LoginHelp() to enable users to reset a forgotten password.

When a user opens a page linked to this secure Layout:

  • Prior to the initialization of the Page, a Javascript function tests for 'logout' in the querystring
    • If present - calls @BRT.Logout() and redirects to a designated page
    • If not present - calls @BRT.UserRecord to test for user authentication
      • User is authenticated - render the page - including a link for the user to refresh the page with a 'logout' querystring
      • User is not authenticated - call @BRT.LoginForm() to render a login form.  Optionally including @BRT.LoginHelp() for a 'reset password' option
        • Success - Page is refreshed with authenticated user
        • Fail - Login form is presented with a 'try again' message.

Example "Secure Layout"

@functions{
    protected EngineRecord _user = null;
    public override void InitializePage() {
         
        
        if (Request.QueryString["logout"] == "logout") {
            BRT.Logout();    
            Response.Redirect("/securepage");
        }else{
            _user = BRT.UserRecord(viewId:"People", fields: new[] {"LastName","FirstName"});  
            if ( _user != null){
                PageData["FirstName"] =  _user.GetString("FirstName");
                PageData["MyId"] = _user.Id;
            }
        }
        base.InitializePage();
    }
}

<div>
    @if(BRT.RenderContext.IsDesign) {
        @RenderBody()
    } else if (_user == null) {
      if(Request.Friendly== "securepagehelp"){
      <div><h2>Login Help</h2></div>
             
        @BRT.LoginHelp(viewId:"People");
      } else {
             <div><h2>Welcome to the Secure Portal</h2></div>
             <p>Please log in to proceed</p>
            <div class="loginform">
                @BRT.LoginForm(viewId:"People")
                 <div>
                    <p></p>
                   <a href="securepagehelp">Need Help Logging in? </a> <span style="font-size:.7em">Read instructions below...</span>
                   <p></p>
                   <hr/>
                   <p>If a valid email address is associated with a Contact record - the LoginHelp Helper can be used to send an account recovery link.</p>
                   <p>If you would like to try this feature out with this Demo website - use the Brick River Web Console to add your email address to one of the Contact profiles using the People View</p>
                   <p>Then use the 'Need Help Logging in? link above.</p>
                   <p>Supply your email address in the form that follows and you will receive a link to re-set the password for that Contact</p>
                 </div>
            </div>  
        }
    } else {
        <div class="well well-sm">Hello @PageData["FirstName"]. You are logged into the members area.
        <input type="button" class="btn btn-default btn-xs pull-right" onclick="self.location = '/@Request.Friendly?logout=logout'" value="Logout">
        <p></p>
            <a href= "@BRT.DataLink(289, recordId:(int)PageData["MyId"])"> Click here to Update User Profile</a>
        </div>
        @RenderBody()
    }                
</div>

 

In the example above the Secure Layout is linked to:

  • The portal landing page "Secure Page" with friendly name "securepage"  (line 8 in the code), and
  • The help page "Secure Page Help" with the friendly name "securepagehelp" (lines 24 and 35 in the code)

 

The Secure Page can contain whatever content is desired.

The Secure Page Help should have no content and the Property: 'Hide from menus' should be enabled to prevent it from appearing on menus, site maps, and breadcrumbs.

Other child pages can be added to Secure Page as long as the Secure Layout is used for those pages.

 

 

 

Want to learn more?

Call 800-924-5220 or

Schedule a demo