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