@BRT.LoginForm()

Displays the login form for users to access secure pages

To create a portal - a set of secure Pages - on a site it is necessary to create a Layout that includes the @BRT.LoginForm() Helper.  The required attribute 'viewId:' indicates the View which includes all users who may access the secure Pages.  This Layout must be linked to all Pages to be included in the secure portal.  Un-authenticated users will be directed to a login form when attempting to access a secure page.
The following example demonstrates a Layout that would be linked to the 'securepage' and 'securepagehelp' Pages.  @BRT.LoginForm uses the People View to validate login attempts.
@functions{
    protected EngineRecord _user = null;    
    public override void InitializePage() {
      BRT.LoginAs(viewId:"People");
        base.InitializePage();
        if (Request.QueryString["logout"] == "logout") {
            @BRT.Logout();    
            Response.Redirect("/comebacksoon");
        }
        else
        {
            _user = BRT.UserRecord(viewId:"People", fields: new[] {"FirstName","LastName","Username"});               
        } 
    }
}
<div>
    @if(BRT.RenderContext.IsDesign) {
        @RenderBody()
    } else if (_user == null) {
      if(Request.Friendly== "securepagehelp"){
        @BRT.LoginHelp(viewId:"People");
      } else {
             <div><h2>Welcome to the Secure Portal</h2></div>
             <p>Please log in to proceed</p>
         <div>
             @BRT.LoginForm(viewId:"People")
            <div><br /><a href="securepagehelp">Need Help Logging in? </a></div>
         </div>  
        }
    } else {
        <div>
You are logged into the members area.
        <input type="button" onclick="self.location = '/@Request.Friendly?logout=logout'" value="Logout">
</div>
        @RenderBody()
    }                
</div>
The following form is presented to an un-authenticated user:
Required Parameters
viewId: Indicates the View which contains the record set to be targeted by the Helper
Example: viewId:"BlogPosts"
The viewID: parameter indicates the View targeted by the Helper. The View can be either visible or invisible to users in the Web Console.
Optional Parameters
condition: Adds a condition to filter records retrieved
Example: condition: (String.IsNullOrEmpty(Request.QueryString["topic"])?null:ConditionMeta.Parse("[Topic.Label]='" + Request.QueryString["topic"] + "'"))
The condition: parameter applies a search or filter condition to limit the EngineRecords retrieved from View named in the Helper's viewId: template.
savedFilters: Applies a saved filter from the View definition
Example: savedFilters:new[] {"LocalNews"}
The savedFilters: parameter names one or more saved filters to be applied to the EngineRecords returned by a Helper.  Values must indicate valid FilterId names included in the definition of the View named in the Helper's viewId: parameter.
template: Applies a Razor template to data elements retrieved by the Helper
Example: template:
            @<div>
            <h4>Meet our Authors!</h4>        
                        @foreach(EngineRecord c in item) {
                              <p><a href="/authordetail?type=@c.GetString("Name")">@c.GetString("Name") </a></p>
                }        
            </div>)
The template: parameter is always an optional parameter but virtually all Helpers that create EngineRecord items use either 'template:' or 'itemTemplate:' to style and present item content.
Syntax is:
template: 
@<div>
Any valid HTML and Razor code
</div>)