Add remember-me login and personalize sport presets
This commit is contained in:
+50
-2
@@ -176,6 +176,47 @@ function mood_icon_path(string $sentiment): string
|
||||
return icon_path('mood-' . $sentiment);
|
||||
}
|
||||
|
||||
function request_is_secure(): bool
|
||||
{
|
||||
$forwardedProto = strtolower((string) ($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? ''));
|
||||
$forwardedSsl = strtolower((string) ($_SERVER['HTTP_X_FORWARDED_SSL'] ?? ''));
|
||||
|
||||
return (
|
||||
(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|
||||
|| $forwardedProto === 'https'
|
||||
|| $forwardedSsl === 'on'
|
||||
);
|
||||
}
|
||||
|
||||
function remember_me_lifetime(): int
|
||||
{
|
||||
return 60 * 60 * 24 * 30;
|
||||
}
|
||||
|
||||
function session_cookie_params_for(int $lifetime = 0): array
|
||||
{
|
||||
return [
|
||||
'lifetime' => $lifetime,
|
||||
'path' => '/',
|
||||
'domain' => '',
|
||||
'secure' => request_is_secure(),
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax',
|
||||
];
|
||||
}
|
||||
|
||||
function session_cookie_options_for(int $expires = 0): array
|
||||
{
|
||||
return [
|
||||
'expires' => $expires,
|
||||
'path' => '/',
|
||||
'domain' => '',
|
||||
'secure' => request_is_secure(),
|
||||
'httponly' => true,
|
||||
'samesite' => 'Lax',
|
||||
];
|
||||
}
|
||||
|
||||
function sport_icon_path(string $icon): string
|
||||
{
|
||||
return icon_path('sport-' . $icon);
|
||||
@@ -184,11 +225,18 @@ function sport_icon_path(string $icon): string
|
||||
function sport_icon_options(): array
|
||||
{
|
||||
return [
|
||||
'strength-home' => 'Kraftsport daheim',
|
||||
'strength-gym' => 'Kraftsport im Gym',
|
||||
'strength' => 'Krafttraining',
|
||||
'bike' => 'Radfahren',
|
||||
'run' => 'Joggen',
|
||||
'hike' => 'Wandern',
|
||||
'swim' => 'Schwimmen',
|
||||
'yoga' => 'Yoga',
|
||||
'hiit' => 'HIIT / Workout',
|
||||
'row' => 'Rudergerät',
|
||||
'dance' => 'Tanzen',
|
||||
'core' => 'Core',
|
||||
'strength-home' => 'Krafttraining Zuhause',
|
||||
'strength-gym' => 'Krafttraining Auswärts',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user