2019-12-07 23:40:42 +07:00
|
|
|
package handlers
|
|
|
|
|
2019-12-24 09:14:52 +07:00
|
|
|
import "github.com/authelia/authelia/internal/middlewares"
|
2019-12-07 23:40:42 +07:00
|
|
|
|
2020-04-21 04:03:38 +07:00
|
|
|
// ConfigurationBody configuration parameters exposed to the frontend.
|
2019-12-07 23:40:42 +07:00
|
|
|
type ConfigurationBody struct {
|
2020-05-16 06:41:42 +07:00
|
|
|
RememberMe bool `json:"remember_me"` // whether remember me is enabled or not
|
|
|
|
ResetPassword bool `json:"reset_password"`
|
2019-12-07 23:40:42 +07:00
|
|
|
}
|
|
|
|
|
2020-04-21 04:03:38 +07:00
|
|
|
// ConfigurationGet fetches configuration parameters for frontend mutation.
|
2019-12-07 23:40:42 +07:00
|
|
|
func ConfigurationGet(ctx *middlewares.AutheliaCtx) {
|
|
|
|
body := ConfigurationBody{
|
2020-05-16 06:41:42 +07:00
|
|
|
RememberMe: ctx.Providers.SessionProvider.RememberMe != 0,
|
|
|
|
ResetPassword: !ctx.Configuration.AuthenticationBackend.DisableResetPassword,
|
2019-12-07 23:40:42 +07:00
|
|
|
}
|
2020-04-22 10:33:14 +07:00
|
|
|
ctx.SetJSONBody(body) //nolint:errcheck // TODO: Legacy code, consider refactoring time permitting.
|
2019-12-07 23:40:42 +07:00
|
|
|
}
|