mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-11-01 09:58:49 +03:00
Improved handling of Internationalized Domain Names in punycode
This commit is contained in:
parent
fd54796710
commit
696a2bbd3c
45 changed files with 661 additions and 236 deletions
|
|
@ -154,26 +154,23 @@ trait UserAuth
|
|||
$oMainAccount = $this->getMainAccountFromToken(false);
|
||||
if ($sEmail && $oMainAccount && $this->GetCapa(Capa::ADDITIONAL_ACCOUNTS)) {
|
||||
$oAccount = null;
|
||||
if ($oMainAccount->Email() === $sEmail) {
|
||||
$this->SetAdditionalAuthToken($oAccount);
|
||||
return true;
|
||||
}
|
||||
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
|
||||
$aAccounts = $this->GetAccounts($oMainAccount);
|
||||
if (!isset($aAccounts[$sEmail])) {
|
||||
throw new ClientException(Notifications::AccountDoesNotExist);
|
||||
}
|
||||
$oAccount = AdditionalAccount::NewInstanceFromTokenArray(
|
||||
$this, $aAccounts[$sEmail]
|
||||
);
|
||||
if (!$oAccount) {
|
||||
throw new ClientException(Notifications::AccountSwitchFailed);
|
||||
}
|
||||
|
||||
// Test the login
|
||||
$oImapClient = new \MailSo\Imap\ImapClient;
|
||||
$this->imapConnect($oAccount, false, $oImapClient);
|
||||
if ($oMainAccount->Email() !== $sEmail) {
|
||||
$sEmail = \SnappyMail\IDN::emailToAscii($sEmail);
|
||||
$aAccounts = $this->GetAccounts($oMainAccount);
|
||||
if (!isset($aAccounts[$sEmail])) {
|
||||
throw new ClientException(Notifications::AccountDoesNotExist);
|
||||
}
|
||||
$oAccount = AdditionalAccount::NewInstanceFromTokenArray(
|
||||
$this, $aAccounts[$sEmail]
|
||||
);
|
||||
if (!$oAccount) {
|
||||
throw new ClientException(Notifications::AccountSwitchFailed);
|
||||
}
|
||||
|
||||
// Test the login
|
||||
$oImapClient = new \MailSo\Imap\ImapClient;
|
||||
$this->imapConnect($oAccount, false, $oImapClient);
|
||||
}
|
||||
$this->SetAdditionalAuthToken($oAccount);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue