Integration via Single Sign-On
While the product supports logging in programmatically, existing method isn't 100% perfect. It requires having main system and webmail application installed within the same domain, and it might present security issues if you transfer login credentials via POST or GET.
So, a different method known as Single Sign-On was implemented to allow for eliminating these issues. It's invoked in a very simple and straightforward way:
<?php
$sEmail="user@domain.com";
$sPassword="....";
$sLogin=$sEmail;
include_once '/opt/afterlogic/html/system/autoload.php';
\Aurora\System\Api::Init(true);
header('Location: http://webmail.domain.com/?sso&hash='.\Aurora\System\Api::GenerateSsoToken($sEmail, $sPassword, $sLogin));
NB: While GenerateSsoToken method technically accepts 3 arguments (email, password and optionally login), login always matches email address. The case where login is different from email is not supported.
In version 8.5.2, we've added a way to force specific interface language when user logs in. It's done by supplying GET-parameter lang as follows:
header('Location: http://webmail.domain.com/?sso&hash='.\Aurora\System\Api::GenerateSsoToken($sEmail, $sPassword, $sLogin).'&lang='.$sLanguage);