How to detect when a user has logged in to different devices (computer, phone) of CodeTime? .. and how close the website session on all dev

I Want to detect when a user has logged in to different devices (computer, phone) of CodeTime .. and how
close the website session on all devices, when closed from a one device ?
1 person has
this question
+1
Reply
  • Cris,

    You can override some of the token methods to implement session management. See example below:

    using System.Web.Security;

    namespace MyCompany.Services
    {
    public partial class ApplicationServices
    {
    public override UserTicket CreateTicket(MembershipUser user, string refreshToken)
    {
    var ticket = base.CreateTicket(user, refreshToken);
    // todo store ticket in db?
    return ticket;
    }

    public override void InvalidateTicket(FormsAuthenticationTicket ticket)
    {
    base.InvalidateTicket(ticket);
    // todo invalidate ticket in database
    }

    public override bool ValidateTicket(FormsAuthenticationTicket ticket)
    {
    // todo check database
    return true;
    }
    }
    }


    Note that by default tokens last for 15 minutes and are automatically renewed (until logged out or session ended). You can manage this value by configuring touch-settings.json

    {
    "membership": {
    "accountManager": {
    "accessTokenDuration": 15,
    "refreshTokenDuration": 10080
    }
    }
    }
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • Is there suppose to be code in the following areas?

    // todo store ticket in db?
    // todo invalidate ticket in database
    // todo check database

    if so, what is it?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • I think they are demonstrating how you could move ticket management to the database, so that you are able to determine what to do when same user is logged in from different devices. Similar to how session management is handled in database versus application.

    Looks like something COT could add to the product, but it currently is not added so you would have to implement it yourself. That's why they just left the comments.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly indifferent, undecided, unconcerned sad, anxious, confused, frustrated happy, confident, thankful, excited