Copied to clipboard

Flag this post as spam?

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


  • Van Helsing 2 posts 72 karma points
    Apr 11, 2016 @ 12:41
    Van Helsing
    0

    Umbraco 7 User Login(backoffice) Programmatically

    Hi,

    How to implement User Login(Backoffice) programmatically like a Backoffice Login Form ?

    Regards.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Apr 11, 2016 @ 12:56
    Dennis Aaen
    0

    Hi Van and welcome to Our :-)

    We have different services that you can use as you can see here

    https://our.umbraco.org/documentation/Reference/Management/Services/

    I know that this service is not on the list yet, but we also have a UserService which you can use for Umbraco backoffice users.

    Hope this helps,

    /Dennis

  • Van Helsing 2 posts 72 karma points
    Apr 13, 2016 @ 07:07
    Van Helsing
    0

    Hi Dennis, Thanks for reply.

    Can you tell me example code, can use this context ? Umbraco.Core.ApplicationContext.Current.Services.UserService

    Or should be use this method BackOfficeSignInManager.PasswordSignInAsync ?

    Thanks..

    Regards, Ivan

  • Arthur 10 posts 80 karma points
    Sep 07, 2018 @ 11:01
    Arthur
    0

    I have tried this but no joy...

    var result = await signInManager.PasswordSignInAsync(user.UserName, loginModel.Password, isPersistent: true, shouldLockout: false); 
    

    this returns true however when i redirect the page to HttpContext.Current.Response.Redirect("http://localhost:57933/umbraco/#");

    i still get umbraco standard login box.

    any help is much appreciated!!! thanks

  • Christian Tricarico 12 posts 92 karma points c-trib
    Oct 01, 2018 @ 14:14
    Christian Tricarico
    0

    To log in a backoffice user use the PerformLogin method:

    //Login backoffice user.
    //NOTE: PerformLogin method not documented in official doc. Src: https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Web/Security/WebSecurity.cs#L150
    var sessionTimeoutInSeconds = UmbracoContext.Security.PerformLogin(userId);
    

    Hope this help.

Please Sign in or register to post replies

Write your reply to:

Draft