Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Pro

 AfterLogic Forum : AfterLogic WebMail Pro
Subject Topic: setting locale programmatically Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
igor.martin
Newbie
Newbie


Joined: 15 July 2020
Location: Ukraine
Online Status: Offline
Posts: 2
Posted: 15 July 2020 at 6:44am | IP Logged Quote igor.martin

Hello there!

We have iframe integration of Webmail into our app and login users via SSO so we omit the login page at all.

The question is: is there a way to set locale programmatically like passing locale parameter or setting a cookie or something?
Back to Top View igor.martin's Profile Search for other posts by igor.martin
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 16 July 2020 at 1:29am | IP Logged Quote Igor

While it's not supported out-of-box, it can be achieved with a small code modification. In system/Api.php file, locate GenerateSsoToken function and add $sLanguage argument:

Code:
public static function GenerateSsoToken($sEmail, $sPassword, $sLogin = '', $sLanguage = '')
{
     $sSsoHash = \md5($sEmail.$sPassword.$sLogin.\microtime(true).\rand(10000, 99999));
     return self::Cacher()->Set('SSO:'.$sSsoHash, self::EncodeKeyValues(array(
          'Email' => $sEmail,
          'Password' => $sPassword,
          'Login' => $sLogin,
          'Language' => $sLanguage
     ))) ? $sSsoHash : '';
}


In modules/Core/Module.php file, locate EntrySso method and modify the following line:

Code:
$aResult = self::Decorator()->Login($aData['Email'], $aData['Password']);


with an argument added:

Code:
$aResult = self::Decorator()->Login($aData['Email'], $aData['Password'], $aData['Language']);


And the argument needs to be supplied when generating SSO hash:

Code:
\Aurora\System\Api::GenerateSsoToken($sEmail, $sPassword, $sLogin, $sLanguage);


Hope this helps.

--
Regards,
Igor, Afterlogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
igor.martin
Newbie
Newbie


Joined: 15 July 2020
Location: Ukraine
Online Status: Offline
Posts: 2
Posted: 17 July 2020 at 1:38am | IP Logged Quote igor.martin

Should help. thank you
Back to Top View igor.martin's Profile Search for other posts by igor.martin
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide