-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
app/controller/auth.go
Outdated
@@ -62,8 +62,15 @@ func Login(c *fiber.Ctx) error { | |||
}) | |||
} | |||
|
|||
var timeToExpire int64 | |||
if login.Remember { | |||
timeToExpire = 1209600 // 14 days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use that config value for remember
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use that config value for remember
so in line 67 timeToExpire = config.Conf.JWTExpireSeconds
?
sorry I think I'm a bit confused, could you explain in more detail a bit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
and I think we do not need that checker function for now, we may do that later, it can be implemented in pure frontend |
oh really? i thought frontend cannot access cookies in localstorage so it would have to be in backend |
cookies and localstorage are two things. These JWT cookies are HttpOnly so they can not be accessed by js directly. But we can store the username in localstorage after success login, at that time, we request |
oh ok! thank you for explaining |
GenerateNewAccessToken()
I may continue trying today to implement a checker func that login form can use to check for current cookie, get the username from id in cookie as well as remember bool, and then autofill login form with username if remember is true - probably not viable just coming up with ideas for it