Open
Conversation
After a Google account is disabled or password reset, we need ADB access to expire in less than 30 days which is the current behavior. However, this change avoids expiring the session too quickly in order to avoid data loss until we can set up sessions to renew automatically before they expire if the user is still working or verify this is already happening.
jakehobbs
approved these changes
Dec 24, 2023
Member
jakehobbs
left a comment
There was a problem hiding this comment.
lgtm but you are gonna make almira's life harder 😆
Collaborator
Author
|
Still thinking about this. In an emergency we could shut down the ADB and start it back up with different keys, and I don't want someone to be in the middle of taking attendance without any indication that their session is expiring imminently. |
Collaborator
Author
|
(In addition to rotating the server key in the event of an emergency) Maybe we can make the cookie expire at 5AM to avoid people getting signed out while trying to do something like taking attendance. Might update this PR for that eventually. ChatGPT and I co-authored this function (not tested) package main
import (
"fmt"
"time"
)
func next5AMPTAfter24Hours() time.Time {
// Get the current time in PT
loc, err := time.LoadLocation("America/Los_Angeles")
if err != nil {
panic(err)
}
now := time.Now().In(loc)
// Calculate 5 AM PT tomorrow
tomorrow := now.AddDate(0, 0, 1)
tomorrow5AM := time.Date(tomorrow.Year(), tomorrow.Month(), tomorrow.Day(), 5, 0, 0, 0, loc)
// If tomorrow's 5 AM PT is more than 24 hours from now, use it
if tomorrow5AM.After(now.Add(24 * time.Hour)) {
return tomorrow5AM
}
// Otherwise, calculate 5 AM PT the day after tomorrow
dayAfterTomorrow := now.AddDate(0, 0, 2)
dayAfterTomorrow5AM := time.Date(dayAfterTomorrow.Year(), dayAfterTomorrow.Month(), dayAfterTomorrow.Day(), 5, 0, 0, 0, loc)
return dayAfterTomorrow5AM
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After a Google account is disabled or password reset, we need ADB access to expire in less than 30 days which is the current behavior. However, this change avoids expiring the session too quickly in order to avoid data loss until we can set up sessions to renew automatically before they expire if the user is still working or verify this is already happening.