Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dmitrij Jazel 86 posts 179 karma points
    Sep 25, 2015 @ 19:13
    Dmitrij Jazel
    0

    Basic member login form Umbraco

    Well there was allot of changes regarding membership since Umbraco 4 etc... and Default .Net membership was added as Profile authentication in Umbraco (as far as I can say). Considering I am not Umbraco pro. developer... And never attended any of the webinars nor certifications.

    In Old days, it was enough to write user control. Today we have things like Json, AngularJS, Oauth and .Net membership and different membership providers.

    But still there should be a fairly standard way for people to add this feature to a new project? Or atleast some ideas on approaching authentication in Umbraco.

  • Vaidas 22 posts 65 karma points
    Sep 27, 2015 @ 10:16
    Vaidas
    1

    I think this article explains the memberships a bit: https://our.umbraco.org/documentation/reference/management/services/memberservice

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Sep 28, 2015 @ 08:01
    Dennis Aaen
    101

    Hi Dmitrij :-)

    If you a looking for basic member login form for Umbraco in Razor, then there are one pre-code snippet in Umbraco.

    It´s contains this code:

    @using System.Web.Mvc.Html
    @using ClientDependency.Core.Mvc
    @using Umbraco.Web
    @using Umbraco.Web.Models
    @using Umbraco.Web.Controllers
    
    @{
        var loginModel = new LoginModel();
    
        Html.EnableClientValidation();
        Html.EnableUnobtrusiveJavaScript();
        Html.RequiresJs("/umbraco_client/ui/jquery.js");
        Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js");
        Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js");
    }
    
    @* NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed *@
    @Html.RenderJsHere()
    
    @using (Html.BeginUmbracoForm<UmbLoginController>("HandleLogin"))
    {
        <fieldset>
            <legend>Login</legend>
    
            @Html.ValidationSummary("loginModel", true)
    
            @Html.LabelFor(m => loginModel.Username)
            @Html.TextBoxFor(m => loginModel.Username)
            @Html.ValidationMessageFor(m => loginModel.Username)
            <br />
    
            @Html.LabelFor(m => loginModel.Password)
            @Html.PasswordFor(m => loginModel.Password)
            @Html.ValidationMessageFor(m => loginModel.Password)
            <br />
    
            <button>Login</button>
        </fieldset>  
    }
    

    There are also other pre-code snippet regarding to login functionality like login status. You can find it, when you create a new partial view or partial view macro file.

    I have added a screenshot so you can see where to find it.

    enter image description here

    Hope this helps,

    /Dennis

  • Dmitrij Jazel 86 posts 179 karma points
    Sep 29, 2015 @ 19:24
    Dmitrij Jazel
    0

    Hi Dennis and Vaidas,

    Thanks allot for useful link, and for the info. Dennis, must give credit to you cause that is exactly what I was looking for! :-)

    Thank you very much very much for help guys! :-)

Please Sign in or register to post replies

Write your reply to:

Draft