Fix cookie bug (#800)

+ small fixes
This commit is contained in:
RainLoop Team 2015-08-14 23:20:47 +04:00
parent 91f3c05d5e
commit 502aebdc37
7 changed files with 47 additions and 29 deletions

View file

@ -12,6 +12,8 @@ var
releasesPath: 'build/dist/releases', releasesPath: 'build/dist/releases',
community: true, community: true,
watch: false, watch: false,
watchInterval: 1000,
googleCompile: false,
rainloopBuilded: false, rainloopBuilded: false,
destPath: '', destPath: '',
@ -81,11 +83,18 @@ function cleanDir(sDir)
.pipe(require('gulp-rimraf')()); .pipe(require('gulp-rimraf')());
} }
function renameFileWothMd5Hash(sFile) function renameFileWithMd5Hash(sFile, callback)
{ {
var sHash = require('crypto').createHash('md5').update(fs.readFileSync(sFile)).digest('hex'); var sHash = require('crypto').createHash('md5').update(fs.readFileSync(sFile)).digest('hex');
fs.renameSync(sFile, sFile.replace(/\.zip$/, '-' + sHash + '.zip')); cfg.lastMd5File = sFile.replace(/\.zip$/, '-' + sHash + '.zip');
return true; fs.renameSync(sFile, cfg.lastMd5File);
callback();
}
function copyFile(sFile, sNewFile, callback)
{
fs.writeFileSync(sNewFile, fs.readFileSync(sFile));
callback();
} }
cfg.paths.globjs = 'dev/**/*.js'; cfg.paths.globjs = 'dev/**/*.js';
@ -450,13 +459,13 @@ gulp.task('js:lint', function() {
.pipe(jshint.reporter('jshint-summary', cfg.summary)) .pipe(jshint.reporter('jshint-summary', cfg.summary))
.pipe(jshint.reporter('fail')) .pipe(jshint.reporter('fail'))
// google compiler // google compiler
.pipe(closureCompiler({ .pipe(gulpif(cfg.googleCompile, closureCompiler({
compilerPath: './build/compiler.jar', compilerPath: './build/compiler.jar',
fileName: 'gc.js', fileName: 'gc.js',
compilerFlags: { compilerFlags: {
output_wrapper: '(function(){%output%}());' output_wrapper: '(function(){%output%}());'
} }
})); })))
; ;
}); });
@ -574,6 +583,7 @@ gulp.task('rainloop:setup', ['rainloop:copy'], function() {
cfg.zipSrcPath = dist; cfg.zipSrcPath = dist;
cfg.zipFile = 'rainloop-' + (cfg.community ? 'community-' : '') + versionFull + '.zip'; cfg.zipFile = 'rainloop-' + (cfg.community ? 'community-' : '') + versionFull + '.zip';
cfg.md5File = cfg.zipFile; cfg.md5File = cfg.zipFile;
cfg.lastMd5File = '';
cfg.rainloopBuilded = true; cfg.rainloopBuilded = true;
}); });
@ -583,15 +593,19 @@ gulp.task('rainloop:zip', ['rainloop:copy', 'rainloop:setup'], function() {
zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false; zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false;
}); });
gulp.task('rainloop:md5', ['rainloop:zip'], function() { gulp.task('rainloop:md5', ['rainloop:zip'], function(callback) {
return (cfg.destPath && cfg.md5File) ? renameFileWithMd5Hash(cfg.destPath + cfg.md5File, callback);
renameFileWothMd5Hash(cfg.destPath + cfg.md5File) : false;
}); });
gulp.task('rainloop:clean', ['rainloop:copy', 'rainloop:setup', 'rainloop:zip'], function() { gulp.task('rainloop:clean', ['rainloop:copy', 'rainloop:setup', 'rainloop:zip'], function() {
return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false; return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
}); });
gulp.task('rainloop:shortname', ['rainloop:md5'], function(callback) {
copyFile(cfg.lastMd5File, cfg.destPath +
'rainloop' + (cfg.community ? '-community' : '') + '-latest.zip', callback);
});
// BUILD (OwnCloud) // BUILD (OwnCloud)
gulp.task('rainloop:owncloud:copy', function() { gulp.task('rainloop:owncloud:copy', function() {
@ -657,15 +671,19 @@ gulp.task('rainloop:owncloud:zip', ['rainloop:owncloud:copy', 'rainloop:owncloud
zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false; zipDir(cfg.zipSrcPath, cfg.destPath, cfg.zipFile) : false;
}); });
gulp.task('rainloop:owncloud:md5', ['rainloop:owncloud:zip'], function() { gulp.task('rainloop:owncloud:md5', ['rainloop:owncloud:zip'], function(callback) {
return (cfg.destPath && cfg.md5File) ? renameFileWithMd5Hash(cfg.destPath + cfg.md5File, callback);
renameFileWothMd5Hash(cfg.destPath + cfg.md5File) : false;
}); });
gulp.task('rainloop:owncloud:clean', ['rainloop:owncloud:copy', 'rainloop:owncloud:setup', 'rainloop:owncloud:zip'], function() { gulp.task('rainloop:owncloud:clean', ['rainloop:owncloud:copy', 'rainloop:owncloud:setup', 'rainloop:owncloud:zip'], function() {
return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false; return (cfg.cleanPath) ? cleanDir(cfg.cleanPath) : false;
}); });
gulp.task('rainloop:owncloud:shortname', ['rainloop:owncloud:md5'], function(callback) {
copyFile(cfg.lastMd5File, cfg.destPath +
'rainloop' + (cfg.community ? '' : '-standard') + '.zip', callback);
});
// MAIN // MAIN
gulp.task('default', ['js:libs', 'js:boot', 'js:openpgp', 'js:openpgpworker', 'js:min', 'css:main:min', 'ckeditor', 'fontastic']); gulp.task('default', ['js:libs', 'js:boot', 'js:openpgp', 'js:openpgpworker', 'js:min', 'css:main:min', 'ckeditor', 'fontastic']);
gulp.task('fast-', ['js:app', 'js:admin', 'js:chunks', 'css:main']); gulp.task('fast-', ['js:app', 'js:admin', 'js:chunks', 'css:main']);
@ -675,14 +693,14 @@ gulp.task('fast+', ['package:community-off', 'fast-']);
gulp.task('rainloop:start', ['js:lint', 'rainloop:copy', 'rainloop:setup']); gulp.task('rainloop:start', ['js:lint', 'rainloop:copy', 'rainloop:setup']);
gulp.task('rainloop-', ['rainloop:start', 'rainloop:zip', 'rainloop:md5', 'rainloop:clean']); gulp.task('rainloop-', ['rainloop:start', 'rainloop:zip', 'rainloop:md5', 'rainloop:clean', 'rainloop:shortname']);
gulp.task('rainloop', ['package:community-on', 'rainloop-']); gulp.task('rainloop', ['package:community-on', 'rainloop-']);
gulp.task('rainloop+', ['package:community-off', 'rainloop-']); gulp.task('rainloop+', ['package:community-off', 'rainloop-']);
gulp.task('owncloud-', ['rainloop:owncloud:copy', gulp.task('owncloud-', ['rainloop:owncloud:copy',
'rainloop:owncloud:copy-rainloop', 'rainloop:owncloud:copy-rainloop:clean', 'rainloop:owncloud:copy-rainloop', 'rainloop:owncloud:copy-rainloop:clean',
'rainloop:owncloud:setup', 'rainloop:owncloud:zip', 'rainloop:owncloud:md5', 'rainloop:owncloud:clean']); 'rainloop:owncloud:setup', 'rainloop:owncloud:zip', 'rainloop:owncloud:md5', 'rainloop:owncloud:clean', 'rainloop:owncloud:shortname']);
gulp.task('owncloud', ['package:community-on', 'owncloud-']); gulp.task('owncloud', ['package:community-on', 'owncloud-']);
gulp.task('owncloud+', ['package:community-off', 'owncloud-']); gulp.task('owncloud+', ['package:community-off', 'owncloud-']);
@ -691,15 +709,15 @@ gulp.task('owncloud+', ['package:community-off', 'owncloud-']);
gulp.task('watch', ['fast'], function() { gulp.task('watch', ['fast'], function() {
cfg.watch = true; cfg.watch = true;
livereload.listen(); livereload.listen();
gulp.watch(cfg.paths.globjs, {interval: 1000}, ['js:app', 'js:admin']); gulp.watch(cfg.paths.globjs, {interval: cfg.watchInterval}, ['js:app', 'js:admin']);
gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']); gulp.watch(cfg.paths.less.main.watch, {interval: cfg.watchInterval}, ['css:main']);
}); });
gulp.task('watch+', ['fast+'], function() { gulp.task('watch+', ['fast+'], function() {
cfg.watch = true; cfg.watch = true;
livereload.listen(); livereload.listen();
gulp.watch(cfg.paths.globjs, {interval: 1000}, ['js:app', 'js:admin']); gulp.watch(cfg.paths.globjs, {interval: cfg.watchInterval}, ['js:app', 'js:admin']);
gulp.watch(cfg.paths.less.main.watch, {interval: 1000}, ['css:main']); gulp.watch(cfg.paths.less.main.watch, {interval: cfg.watchInterval}, ['css:main']);
}); });
// ALIASES // ALIASES

View file

@ -2,7 +2,7 @@
"name": "RainLoop", "name": "RainLoop",
"title": "RainLoop Webmail", "title": "RainLoop Webmail",
"version": "1.9.2", "version": "1.9.2",
"release": "351", "release": "353",
"description": "Simple, modern & fast web-based email client", "description": "Simple, modern & fast web-based email client",
"homepage": "http://rainloop.net", "homepage": "http://rainloop.net",
"main": "gulpfile.js", "main": "gulpfile.js",
@ -40,7 +40,7 @@
"plugins" "plugins"
], ],
"readmeFilename": "README.md", "readmeFilename": "README.md",
"ownCloudPackageVersion": "4.5", "ownCloudPackageVersion": "4.6",
"engines": { "engines": {
"node": ">= 0.10.0" "node": ">= 0.10.0"
}, },

View file

@ -949,10 +949,7 @@ class MailClient
} }
/** /**
* @param string $sSearch * @return bool
* @param bool $bDetectGmail = true
*
* @return string
*/ */
public function IsGmail() public function IsGmail()
{ {

View file

@ -1524,7 +1524,6 @@ class Actions
$oSettings = $this->SettingsProvider()->Load($oAccount); $oSettings = $this->SettingsProvider()->Load($oAccount);
if (!$oAccount->IsAdditionalAccount() && !empty($aResult['WelcomePageUrl']) && if (!$oAccount->IsAdditionalAccount() && !empty($aResult['WelcomePageUrl']) &&
('once' === $aResult['WelcomePageDisplay'] || 'always' === $aResult['WelcomePageDisplay'])) ('once' === $aResult['WelcomePageDisplay'] || 'always' === $aResult['WelcomePageDisplay']))
{ {

View file

@ -108,7 +108,7 @@ class Api
$sSslCafile = \RainLoop\Api::Config()->Get('ssl', 'cafile', ''); $sSslCafile = \RainLoop\Api::Config()->Get('ssl', 'cafile', '');
$sSslCapath = \RainLoop\Api::Config()->Get('ssl', 'capath', ''); $sSslCapath = \RainLoop\Api::Config()->Get('ssl', 'capath', '');
\RainLoop\Utils::$CookieDefaultPath = \RainLoop\Api::Config()->Get('labs', 'cookie_path', '/'); \RainLoop\Utils::$CookieDefaultPath = \RainLoop\Api::Config()->Get('labs', 'cookie_default_path', '');
if (!empty($sSslCafile) || !empty($sSslCapath)) if (!empty($sSslCafile) || !empty($sSslCapath))
{ {

View file

@ -348,7 +348,7 @@ Enables caching in the system'),
'fast_cache_memcache_port' => array(11211), 'fast_cache_memcache_port' => array(11211),
'fast_cache_memcache_expire' => array(43200), 'fast_cache_memcache_expire' => array(43200),
'use_local_proxy_for_external_images' => array(false), 'use_local_proxy_for_external_images' => array(false),
'cookie_path' => array('/'), 'cookie_default_path' => array(''),
'startup_url' => array(''), 'startup_url' => array(''),
'emogrifier' => array(true), 'emogrifier' => array(true),
'dev_email' => array(''), 'dev_email' => array(''),

View file

@ -7,7 +7,7 @@ class Utils
/** /**
* @var string * @var string
*/ */
static $CookieDefaultPath = '/'; static $CookieDefaultPath = '';
static $Cookies = null; static $Cookies = null;
@ -518,6 +518,7 @@ class Utils
if (null === $sPath) if (null === $sPath)
{ {
$sPath = \RainLoop\Utils::$CookieDefaultPath; $sPath = \RainLoop\Utils::$CookieDefaultPath;
$sPath = $sPath && 0 < \strlen($sPath) ? $sPath : null;
} }
\RainLoop\Utils::$Cookies[$sName] = $sValue; \RainLoop\Utils::$Cookies[$sName] = $sValue;
@ -531,8 +532,11 @@ class Utils
\RainLoop\Utils::$Cookies = is_array($_COOKIE) ? $_COOKIE : array(); \RainLoop\Utils::$Cookies = is_array($_COOKIE) ? $_COOKIE : array();
} }
$sPath = \RainLoop\Utils::$CookieDefaultPath;
$sPath = $sPath && 0 < \strlen($sPath) ? $sPath : null;
unset(\RainLoop\Utils::$Cookies[$sName]); unset(\RainLoop\Utils::$Cookies[$sName]);
@\setcookie($sName, '', \time() - 3600 * 24 * 30); @\setcookie($sName, '', \time() - 3600 * 24 * 30, $sPath);
} }
/** /**