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

18 lines
578 B
PHP
Raw Permalink Normal View History

2023-06-15 04:43:19 +02:00
<?php
// Enable SnappyMail Api and include index file
$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = true;
require 'app/index.php';
2023-06-15 04:43:19 +02:00
// 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);
2023-06-15 04:43:19 +02:00
}
else {
\header('Location: https://__DOMAIN____PATH__/app/');
2023-06-15 04:43:19 +02:00
}