Fixes Remember Me functionality

- Adjust the remember me duration to 1 year
- Fixes #552
pull/558/head
James Elliott 2020-01-17 13:36:18 +11:00 committed by Clément Michaud
parent ece4423d33
commit e6ddedf23d
1 changed files with 2 additions and 2 deletions

View File

@ -76,9 +76,9 @@ func FirstFactorPost(ctx *middlewares.AutheliaCtx) {
return return
} }
// and avoid the cookie to expire if "Remember me" was ticked. // set the cookie to expire in 1 year if "Remember me" was ticked.
if *bodyJSON.KeepMeLoggedIn { if *bodyJSON.KeepMeLoggedIn {
err = ctx.Providers.SessionProvider.UpdateExpiration(ctx.RequestCtx, time.Duration(0)) err = ctx.Providers.SessionProvider.UpdateExpiration(ctx.RequestCtx, time.Duration(31556952 * time.Second))
if err != nil { if err != nil {
ctx.Error(fmt.Errorf("Unable to update expiration timer for user %s: %s", bodyJSON.Username, err), authenticationFailedMessage) ctx.Error(fmt.Errorf("Unable to update expiration timer for user %s: %s", bodyJSON.Username, err), authenticationFailedMessage)
return return