Copied to clipboard

Flag this post as spam?

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


  • Lotte Pitcher 40 posts 191 karma points MVP 4x c-trib
    Jun 23, 2015 @ 08:06
    Lotte Pitcher
    0

    Email notification when user logs into back office / user last logged in

    We are in the early stages of a new project and I would like to keep an eye on how engaged the client is.

    We could log in every day and have a look around for signs of activity (their initial tasks are in custom sections, not in the content tree). But it would be a lot easier if we could receive an email notification whenever a user logs into the back office.

    Any suggestions on how I could achieve this please? I've had a look at the UserService but couldn't see any appropriate event handler.

    If not, is there a way to see the list of back office users with the date/time that they last logged in?

    Thanks

    Lotte

  • Sören Deger 726 posts 2833 karma points c-trib
    Jun 23, 2015 @ 08:49
    Sören Deger
    101

    Hi Lotte,

    you can create your own simple membership provider for backoffice users. Use the ValidateUser() method to do any stuff you like after login.

    Here is a related topic: https://our.umbraco.org/forum/developers/extending-umbraco/36565-Custom-Membership-Provider

    Hope this helps?

    Best, Sören

  • Lotte Pitcher 40 posts 191 karma points MVP 4x c-trib
    Jun 23, 2015 @ 09:07
    Lotte Pitcher
    1

    Hi Sören,

    I've implemented custom membership providers for Members before but didn't realise that you could for back office Users.

    So I've done what you suggested:

    public class CustomUsersMembershipProvider : Umbraco.Web.Security.Providers.UsersMembershipProvider
    {
        public override bool ValidateUser(string username, string password)
        {
            var success = base.ValidateUser(username, password);
            if (success)
            {
                //add emailing code here
            }
            return success;
        }
    }
    

    And debugged through and all works perfectly!

    Many thanks indeed

    Lotte

  • Kasper Holm 47 posts 180 karma points
    Jun 23, 2015 @ 08:50
    Kasper Holm
    0

    Hey Lotte

    Here is an idea

    I if you look in the 'UmbracoLogs' table in the database there is a pretty good overview of what the users do :)

    I am not totally sure that that still exits in version 7 tho.

  • Sören Deger 726 posts 2833 karma points c-trib
    Jun 23, 2015 @ 09:11
    Sören Deger
    0

    Hi Lotte,

    great that I could help you :-) And thanks for sharing your code!

    Cheers,

    Sören

  • Lotte Pitcher 40 posts 191 karma points MVP 4x c-trib
    Apr 26, 2016 @ 15:21
    Lotte Pitcher
    0

    For anyone who finds this and is using v7.3 or later...

    This approach no longer works due to the security changes implemented in v7.3!

    For more info see https://our.umbraco.org/documentation/Reference/Security/

Please Sign in or register to post replies

Write your reply to:

Draft