1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snappymail_ynh.git synced 2024-09-03 20:26:29 +02:00
snappymail_ynh/conf/sso.php
2023-08-05 00:56:55 +02:00

17 lines
578 B
PHP

<?php
// Enable SnappyMail Api and include index file
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
require 'app/index.php';
// Retrieve email and password
if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
$email = $_SERVER['HTTP_EMAIL'];
$password = $_SERVER['PHP_AUTH_PW'];
$ssoHash = \RainLoop\Api::CreateUserSsoHash($email, $password);
// redirect to webmail sso url
\header('Location: https://__DOMAIN____PATH__/app/?sso&hash='.$ssoHash);
}
else {
\header('Location: https://__DOMAIN____PATH__/app/');
}