public static async Task <bool> HasActiveSession(User user) { UserSession?match = await UserSessionModel.Find(user); if (match == null) { return(false); } if (DateTime.Now.Subtract(match.RefreshedAt) > TimeSpan.FromDays(7)) { return(false); } return(true); }
public static async Task <UserSession?> FindSession(string token) { return(await UserSessionModel.Find(token)); }