umbraco Make a SurfaceController to allow members to log in Add a view

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Then make a view in the folder /Views/MacroPartials/Account

@model MyCMS.Models.Account.MemberLoginViewModel
@using MyCMS.Controllers.Account

@if (User.Identity.IsAuthenticated)
{
        <p>Logged in as: @User.Identity.Name</p>
        using (Html.BeginUmbracoForm<MemberLoginSurfaceController>("MemberLogout", FormMethod.Post, new { id = "logoutForm" }))
        {
            @Html.AntiForgeryToken()
         <button type="submit" class="btn btn-outline-secondary">Log out</button>
         }

}
else
{
    using (Html.BeginUmbracoForm<MemberLoginSurfaceController>("MemberLoginPost", "MemberLoginSurface", new { @class = "form-inline" }))
    {
        <div class="form-group">
            <label for="email">Email</label>
            <input name="Email" type="email" class="form-control" id="loginform_email" placeholder="[email protected]">
        </div>
                <div class="form-group">
                    <label for="password">Password</label>
                    <input name="Password" type="password" class="form-control" id="loginform_password" placeholder="*****">
                </div>
                <div class="form-check">
                    <label class="form-check-label">
                        <input name="RememberMe" class="form-check-input" type="checkbox">Husk meg
                    </label>
                </div>
                <button type="submit" class="btn btn-outline-secondary">Log in</button>

    }
    <p>@TempData["Status"]</p>
}  


Got any umbraco Question?