mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Add additional logging for OpenPGP
Remove enforcing lower case for email addresses Small fixes
This commit is contained in:
parent
436e54891e
commit
3498700f61
11 changed files with 89 additions and 17 deletions
|
|
@ -124,11 +124,10 @@
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
oE = null,
|
oE = null,
|
||||||
oLink = null,
|
oLink = null
|
||||||
sUserAgent = window.navigator.userAgent.toLowerCase()
|
|
||||||
;
|
;
|
||||||
|
|
||||||
if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
|
if (Globals.sUserAgent && (Globals.sUserAgent.indexOf('chrome') > -1 || Globals.sUserAgent.indexOf('chrome') > -1))
|
||||||
{
|
{
|
||||||
oLink = window.document.createElement('a');
|
oLink = window.document.createElement('a');
|
||||||
oLink['href'] = sLink;
|
oLink['href'] = sLink;
|
||||||
|
|
|
||||||
|
|
@ -1383,7 +1383,14 @@
|
||||||
|
|
||||||
if (window.Worker)
|
if (window.Worker)
|
||||||
{
|
{
|
||||||
PgpStore.openpgp.initWorker(Links.openPgpWorkerJs());
|
try
|
||||||
|
{
|
||||||
|
PgpStore.openpgp.initWorker(Links.openPgpWorkerJs());
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
Utils.log(e);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// PgpStore.openpgp.config.useWebCrypto = false;
|
// PgpStore.openpgp.config.useWebCrypto = false;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@
|
||||||
_ = require('_'),
|
_ = require('_'),
|
||||||
ko = require('ko'),
|
ko = require('ko'),
|
||||||
|
|
||||||
|
Utils = require('Common/Utils'),
|
||||||
|
|
||||||
PgpStore = require('Stores/User/Pgp'),
|
PgpStore = require('Stores/User/Pgp'),
|
||||||
|
|
||||||
AbstractModel = require('Knoin/AbstractModel')
|
AbstractModel = require('Knoin/AbstractModel')
|
||||||
|
|
@ -58,8 +60,11 @@
|
||||||
return oKey.keys;
|
return oKey.keys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e)
|
||||||
|
{
|
||||||
|
Utils.log(e);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,16 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oMessage = self.openpgp.message.readArmored(sData);
|
var oMessage = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
oMessage = self.openpgp.message.readArmored(sData);
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
Utils.log(e);
|
||||||
|
};
|
||||||
|
|
||||||
if (oMessage && oMessage.getText && oMessage.verify && oMessage.decrypt)
|
if (oMessage && oMessage.getText && oMessage.verify && oMessage.decrypt)
|
||||||
{
|
{
|
||||||
self.decryptMessage(oMessage, function (oValidPrivateKey, oDecriptedMessage, oValidPublicKey, aSigningKeyIds) {
|
self.decryptMessage(oMessage, function (oValidPrivateKey, oDecriptedMessage, oValidPublicKey, aSigningKeyIds) {
|
||||||
|
|
@ -361,7 +370,16 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var oMessage = self.openpgp.cleartext.readArmored(sData);
|
var oMessage = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
oMessage = self.openpgp.cleartext.readArmored(sData);
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
Utils.log(e);
|
||||||
|
};
|
||||||
|
|
||||||
if (oMessage && oMessage.getText && oMessage.verify)
|
if (oMessage && oMessage.getText && oMessage.verify)
|
||||||
{
|
{
|
||||||
self.verifyMessage(oMessage, function (oValidKey, aSigningKeyIds) {
|
self.verifyMessage(oMessage, function (oValidKey, aSigningKeyIds) {
|
||||||
|
|
|
||||||
|
|
@ -389,7 +389,6 @@ html.rl-no-preview-pane {
|
||||||
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
|
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
|
||||||
display: block;
|
display: block;
|
||||||
max-width: 700px;
|
max-width: 700px;
|
||||||
white-space: pre;
|
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -407,7 +406,6 @@ html.rl-no-preview-pane {
|
||||||
border: none;
|
border: none;
|
||||||
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
|
font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
|
||||||
display: block;
|
display: block;
|
||||||
white-space: pre;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pre.b-plain-openpgp {
|
pre.b-plain-openpgp {
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,8 @@
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
|
Utils.log(e);
|
||||||
|
|
||||||
self.notification(Translator.i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
self.notification(Translator.i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||||
'ERROR': '' + e
|
'ERROR': '' + e
|
||||||
}));
|
}));
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
|
Utils.log(e);
|
||||||
self.submitRequest(false);
|
self.submitRequest(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -550,6 +550,22 @@ END;
|
||||||
return \MailSo\Base\Utils::IsAscii($sValue) ? \strtoupper($sValue) : $sValue;
|
return \MailSo\Base\Utils::IsAscii($sValue) ? \strtoupper($sValue) : $sValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $sValue
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function StrMailDomainToLowerIfAscii($sValue)
|
||||||
|
{
|
||||||
|
$aParts = \explode('@', $sValue, 2);
|
||||||
|
if (!empty($aParts[1]))
|
||||||
|
{
|
||||||
|
$aParts[1] = \MailSo\Base\Utils::IsAscii($aParts[1]) ? \strtolower($aParts[1]) : $aParts[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return \implode('@', $aParts);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $sValue
|
* @param string $sValue
|
||||||
*
|
*
|
||||||
|
|
@ -2415,7 +2431,7 @@ END;
|
||||||
catch (\Exception $oException) {}
|
catch (\Exception $oException) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sStr) : $sStr;
|
return $bLowerIfAscii ? \MailSo\Base\Utils::StrMailDomainToLowerIfAscii($sStr) : $sStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2426,7 +2442,7 @@ END;
|
||||||
*/
|
*/
|
||||||
public static function IdnToAscii($sStr, $bLowerIfAscii = false)
|
public static function IdnToAscii($sStr, $bLowerIfAscii = false)
|
||||||
{
|
{
|
||||||
$sStr = $bLowerIfAscii ? \MailSo\Base\Utils::StrToLowerIfAscii($sStr) : $sStr;
|
$sStr = $bLowerIfAscii ? \MailSo\Base\Utils::StrMailDomainToLowerIfAscii($sStr) : $sStr;
|
||||||
|
|
||||||
$sUser = '';
|
$sUser = '';
|
||||||
$sDomain = $sStr;
|
$sDomain = $sStr;
|
||||||
|
|
|
||||||
|
|
@ -213,12 +213,31 @@ class Actions
|
||||||
{
|
{
|
||||||
$this->oConfig = new \RainLoop\Config\Application();
|
$this->oConfig = new \RainLoop\Config\Application();
|
||||||
|
|
||||||
|
// $bSave = defined('APP_INSTALLED_START');
|
||||||
|
// if (!$this->oConfig->Load())
|
||||||
|
// {
|
||||||
|
// $bSave = true;
|
||||||
|
// }
|
||||||
|
// else if (!$bSave)
|
||||||
|
// {
|
||||||
|
// $bSave = APP_VERSION !== $this->oConfig->Get('version', 'current');
|
||||||
|
// }
|
||||||
|
|
||||||
$bSave = defined('APP_INSTALLED_START');
|
$bSave = defined('APP_INSTALLED_START');
|
||||||
if (!$this->oConfig->Load())
|
|
||||||
|
$bLoaded = $this->oConfig->Load();
|
||||||
|
if (!$bLoaded && !$bSave)
|
||||||
|
{
|
||||||
|
usleep(10000); // TODO
|
||||||
|
$bLoaded = $this->oConfig->Load();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$bLoaded && !$this->oConfig->IsFileExists())
|
||||||
{
|
{
|
||||||
$bSave = true;
|
$bSave = true;
|
||||||
}
|
}
|
||||||
else if (!$bSave)
|
|
||||||
|
if ($bLoaded && !$bSave)
|
||||||
{
|
{
|
||||||
$bSave = APP_VERSION !== $this->oConfig->Get('version', 'current');
|
$bSave = APP_VERSION !== $this->oConfig->Get('version', 'current');
|
||||||
}
|
}
|
||||||
|
|
@ -1996,8 +2015,7 @@ class Actions
|
||||||
{
|
{
|
||||||
$this->Plugins()->RunHook('filter.login-credentials.step-1', array(&$sEmail, &$sPassword));
|
$this->Plugins()->RunHook('filter.login-credentials.step-1', array(&$sEmail, &$sPassword));
|
||||||
|
|
||||||
$sEmail = \MailSo\Base\Utils::StrToLowerIfAscii(
|
$sEmail = \MailSo\Base\Utils::StrToLowerIfAscii(\MailSo\Base\Utils::Trim($sEmail));
|
||||||
\MailSo\Base\Utils::Trim($sEmail));
|
|
||||||
|
|
||||||
if (false === \strpos($sEmail, '@'))
|
if (false === \strpos($sEmail, '@'))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,14 @@ abstract class AbstractConfig
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function IsFileExists()
|
||||||
|
{
|
||||||
|
return \file_exists($this->sFile);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ class Property
|
||||||
// lower
|
// lower
|
||||||
if ($this->IsEmail())
|
if ($this->IsEmail())
|
||||||
{
|
{
|
||||||
$this->Value = \MailSo\Base\Utils::StrToLowerIfAscii($this->Value);
|
$this->Value = \MailSo\Base\Utils::StrMailDomainToLowerIfAscii($this->Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->IsName())
|
if ($this->IsName())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue