mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
parent
e82108ac85
commit
4a47796781
29 changed files with 724 additions and 195 deletions
51
Gruntfile.js
51
Gruntfile.js
|
|
@ -10,7 +10,7 @@ module.exports = function (grunt) {
|
|||
cfg: {
|
||||
devVersion: "0.0.0",
|
||||
releasesPath: 'build/dist/releases',
|
||||
releasesSrcPath: '',
|
||||
releaseSrcPath: '',
|
||||
releaseFolder: 'rainloop',
|
||||
releaseZipFile: 'rainloop.zip'
|
||||
},
|
||||
|
|
@ -375,6 +375,17 @@ module.exports = function (grunt) {
|
|||
cwd: '<%= cfg.releasesPath %>/<%= cfg.releaseFolder %>/src/',
|
||||
src: ['**/*']
|
||||
}]
|
||||
},
|
||||
own: {
|
||||
options: {
|
||||
archive: '<%= cfg.releasesPath %>/<%= cfg.releaseFolder %>/<%= cfg.releaseZipFile %>',
|
||||
mode: 'zip'
|
||||
},
|
||||
files: [{
|
||||
expand: true,
|
||||
cwd: '<%= cfg.releasesPath %>/<%= cfg.releaseFolder %>/owncloud/',
|
||||
src: ['**/*']
|
||||
}]
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -450,15 +461,42 @@ module.exports = function (grunt) {
|
|||
packageJsonContent.replace(/"release":\s?"[\d]+",/, '"release": "' + (1 + parseInt(release, 10)) + '",'));
|
||||
|
||||
grunt.config.set('cfg.releaseFolder', versionFull);
|
||||
grunt.config.set('cfg.releasesSrcPath', dist);
|
||||
grunt.config.set('cfg.releaseSrcPath', dist);
|
||||
grunt.config.set('cfg.releaseZipFile', 'rainloop-' + versionFull + '.zip');
|
||||
});
|
||||
|
||||
grunt.registerTask('rainloop-owncloud', 'RainLoop ownCloud App build task', function () {
|
||||
|
||||
var
|
||||
content = '',
|
||||
version = grunt.config('pkg.version'),
|
||||
release = grunt.config('pkg.release'),
|
||||
releasesPath = grunt.config('cfg.releasesPath'),
|
||||
devVersion = grunt.config('cfg.devVersion'),
|
||||
versionFull = version + '.' + release,
|
||||
dist = releasesPath + '/' + versionFull + '/owncloud/'
|
||||
;
|
||||
|
||||
grunt.file.mkdir(dist);
|
||||
|
||||
require('wrench').copyDirSyncRecursive('build/owncloud/rainloop-app',
|
||||
dist, {'forceDelete': true});
|
||||
|
||||
content = grunt.file.read(dist + 'appinfo/info.xml');
|
||||
|
||||
grunt.file.write(dist + 'appinfo/info.xml',
|
||||
content.replace('<version>0.0.0</version>', '<version>' + version + '</version>'));
|
||||
|
||||
grunt.config.set('cfg.releaseFolder', versionFull);
|
||||
grunt.config.set('cfg.releaseSrcPath', dist);
|
||||
grunt.config.set('cfg.releaseZipFile', 'rainloop-owncloud-app-' + versionFull + '.zip');
|
||||
});
|
||||
|
||||
grunt.registerTask('rainloop-clear', 'RainLoop Webmail clear task', function () {
|
||||
var releasesSrcPath = grunt.config('cfg.releasesSrcPath');
|
||||
if ('' !== releasesSrcPath)
|
||||
var releaseSrcPath = grunt.config('cfg.releaseSrcPath');
|
||||
if ('' !== releaseSrcPath)
|
||||
{
|
||||
require('wrench').rmdirSyncRecursive(releasesSrcPath);
|
||||
require('wrench').rmdirSyncRecursive(releaseSrcPath);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -479,6 +517,7 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask('default', ['less', 'concat', 'cssmin', 'jshint', 'rlmin']);
|
||||
grunt.registerTask('build', ['default', 'rainloop', 'compress:build', 'md5:build', 'rainloop-clear']);
|
||||
grunt.registerTask('fast', ['less', 'concat']);
|
||||
grunt.registerTask('owncloud', ['rainloop-owncloud', 'compress:own', 'md5:build', 'rainloop-clear']);
|
||||
|
||||
// aliases
|
||||
grunt.registerTask('u', ['uglify']);
|
||||
|
|
@ -486,4 +525,6 @@ module.exports = function (grunt) {
|
|||
grunt.registerTask('b', ['build']);
|
||||
grunt.registerTask('f', ['fast']);
|
||||
grunt.registerTask('w', ['default', 'watch']);
|
||||
grunt.registerTask('o', ['owncloud']);
|
||||
grunt.registerTask('own', ['owncloud']);
|
||||
};
|
||||
|
|
|
|||
29
build/owncloud/rainloop-app/INSTALL
Normal file
29
build/owncloud/rainloop-app/INSTALL
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
************************************************************************
|
||||
*
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*
|
||||
************************************************************************
|
||||
|
||||
INSTALL:
|
||||
- Unpack the RainLoop Webmail application package in the apps directory of your OwnCloud instance
|
||||
|
||||
CONFIGURATION:
|
||||
|
||||
RainLoop:
|
||||
1) Open ../_default_/configs/application.ini
|
||||
2) Find:
|
||||
|
||||
[labs]
|
||||
allow_external_sso = On
|
||||
external_sso_key = "super-secret-key"
|
||||
|
||||
ownCloud:
|
||||
1) In the Apps > Enable 'RainLoop' plugin
|
||||
2) In the Settings > Admin > Enter "RainLoop Webmail URL" and "SSO key"
|
||||
3) In the Settings > Personal > Type your mail server email and password
|
||||
|
||||
19
build/owncloud/rainloop-app/admin.php
Normal file
19
build/owncloud/rainloop-app/admin.php
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\User::checkAdminUser();
|
||||
|
||||
OCP\Util::addScript('rainloop', 'admin');
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'admin');
|
||||
$oTemplate->assign('rainloop-url', OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$oTemplate->assign('rainloop-sso-key', OCP\Config::getAppValue('rainloop', 'rainloop-sso-key', ''));
|
||||
return $oTemplate->fetchPage();
|
||||
33
build/owncloud/rainloop-app/ajax/admin.php
Normal file
33
build/owncloud/rainloop-app/ajax/admin.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\JSON::checkAdminUser();
|
||||
OCP\JSON::checkAppEnabled('rainloop');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$sUrl = '';
|
||||
$sSsoKey = '';
|
||||
if (isset($_POST['appname'], $_POST['rainloop-url'], $_POST['rainloop-sso-key']) && 'rainloop' === $_POST['appname'])
|
||||
{
|
||||
OCP\Config::setAppValue('rainloop', 'rainloop-url', $_POST['rainloop-url']);
|
||||
OCP\Config::setAppValue('rainloop', 'rainloop-sso-key', $_POST['rainloop-sso-key']);
|
||||
|
||||
$sUrl = OCP\Config::getAppValue('rainloop', 'rainloop-url', '');
|
||||
$sSsoKey = OCP\Config::getAppValue('rainloop', 'rainloop-sso-key', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
OC_JSON::error(array('Message' => 'Invalid Argument(s)', 'Url' => $sUrl, 'SsoKey' => $sSsoKey));
|
||||
return false;
|
||||
}
|
||||
|
||||
OCP\JSON::success(array('Message' => 'Saved successfully', 'Url' => $sUrl, 'SsoKey' => $sSsoKey));
|
||||
return true;
|
||||
45
build/owncloud/rainloop-app/ajax/personal.php
Normal file
45
build/owncloud/rainloop-app/ajax/personal.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('rainloop');
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$sEmail = '';
|
||||
$sLogin = '';
|
||||
if (isset($_POST['appname'], $_POST['rainloop-password'], $_POST['rainloop-email']) && 'rainloop' === $_POST['appname'])
|
||||
{
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
$sPostEmail = $_POST['rainloop-email'];
|
||||
$sPostLogin = isset($_POST['rainloop-login']) ? $_POST['rainloop-login'] : '';
|
||||
|
||||
OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-email', $sPostEmail);
|
||||
|
||||
$sPass = $_POST['rainloop-password'];
|
||||
if ('******' !== $sPass && '' !== $sPass)
|
||||
{
|
||||
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
|
||||
OCP\Config::setUserValue($sUser, 'rainloop', 'rainloop-password',
|
||||
OC_RainLoop_Helper::encodePassword($sPass, md5($sPostEmail.$sPostLogin)));
|
||||
}
|
||||
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
$sLogin = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', '');
|
||||
}
|
||||
else
|
||||
{
|
||||
OC_JSON::error(array('Message' => 'Invalid argument(s)', 'Email' => $sEmail, 'Login' => $sLogin));
|
||||
return false;
|
||||
}
|
||||
|
||||
OCP\JSON::success(array('Message' => 'Saved successfully', 'Email' => $sEmail, 'Login' => $sLogin));
|
||||
return true;
|
||||
23
build/owncloud/rainloop-app/appinfo/app.php
Normal file
23
build/owncloud/rainloop-app/appinfo/app.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/owncloud
|
||||
*/
|
||||
|
||||
OCP\App::registerAdmin('rainloop', 'admin');
|
||||
OCP\App::registerPersonal('rainloop', 'personal');
|
||||
|
||||
OCP\Util::addScript('rainloop', 'rainloop');
|
||||
|
||||
OCP\App::addNavigationEntry(array(
|
||||
'id' => 'rainloop_index',
|
||||
'order' => 10,
|
||||
'href' => OCP\Util::linkTo('rainloop', 'index.php'),
|
||||
'icon' => OCP\Util::imagePath('rainloop', 'mail.png'),
|
||||
'name' => 'RainLoop'
|
||||
));
|
||||
10
build/owncloud/rainloop-app/appinfo/info.xml
Normal file
10
build/owncloud/rainloop-app/appinfo/info.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<info>
|
||||
<id>rainloop</id>
|
||||
<name>RainLoop</name>
|
||||
<description>RainLoop Webmail</description>
|
||||
<version>0.0.0</version>
|
||||
<licence>CC BY-NC-SA 3.0</licence>
|
||||
<author>RainLoop Team</author>
|
||||
<require>6.0</require>
|
||||
</info>
|
||||
BIN
build/owncloud/rainloop-app/img/logo-64x64.png
Normal file
BIN
build/owncloud/rainloop-app/img/logo-64x64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 832 B |
BIN
build/owncloud/rainloop-app/img/mail.png
Normal file
BIN
build/owncloud/rainloop-app/img/mail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
41
build/owncloud/rainloop-app/index.php
Normal file
41
build/owncloud/rainloop-app/index.php
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\User::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('rainloop');
|
||||
OCP\App::setActiveNavigationEntry('rainloop_index');
|
||||
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sSsoKey = trim(OCP\Config::getAppValue('rainloop', 'rainloop-sso-key', ''));
|
||||
|
||||
if ('' === $sUrl || '' === $sSsoKey)
|
||||
{
|
||||
$oTemplate = new OCP\Template('rainloop', 'index-empty', 'user');
|
||||
}
|
||||
else
|
||||
{
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
$sLogin = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', '');
|
||||
$sPassword = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
|
||||
include_once OC_App::getAppPath('rainloop').'/lib/RainLoopHelper.php';
|
||||
$sPassword = OC_RainLoop_Helper::decodePassword($sPassword, md5($sEmail.$sLogin));
|
||||
$sSsoHash = OC_RainLoop_Helper::getSsoHash($sUrl, $sSsoKey, $sEmail, $sPassword, $sLogin);
|
||||
|
||||
$sResultUrl = empty($sSsoHash) ? $sUrl : $sUrl.'?sso&hash='.$sSsoHash;
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'index', 'user');
|
||||
$oTemplate->assign('rainloop-url', $sResultUrl);
|
||||
}
|
||||
|
||||
$oTemplate->printpage();
|
||||
13
build/owncloud/rainloop-app/js/admin.js
Normal file
13
build/owncloud/rainloop-app/js/admin.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
RainLoopFormHelper('#mail-rainloop-admin-form', 'admin.php');
|
||||
});
|
||||
13
build/owncloud/rainloop-app/js/personal.js
Normal file
13
build/owncloud/rainloop-app/js/personal.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
RainLoopFormHelper('#mail-rainloop-personal-form', 'personal.php');
|
||||
});
|
||||
76
build/owncloud/rainloop-app/js/rainloop.js
Normal file
76
build/owncloud/rainloop-app/js/rainloop.js
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
|
||||
function RainLoopFormHelper(sID, sAjaxFile, fCallback)
|
||||
{
|
||||
try
|
||||
{
|
||||
var
|
||||
oForm = $(sID),
|
||||
oSubmit = $('#rainloop-save-button', oForm),
|
||||
sSubmitValue = oSubmit.val(),
|
||||
oDesc = oForm.find('.rainloop-result-desc')
|
||||
;
|
||||
|
||||
oSubmit.click(function (oEvent) {
|
||||
|
||||
var oDefAjax = null;
|
||||
|
||||
oEvent.preventDefault();
|
||||
|
||||
oForm
|
||||
.addClass('rainloop-ajax')
|
||||
.removeClass('rainloop-error')
|
||||
.removeClass('rainloop-success')
|
||||
;
|
||||
|
||||
oDesc.text('');
|
||||
oSubmit.val('...');
|
||||
|
||||
oDefAjax = $.ajax({
|
||||
'type': 'POST',
|
||||
'async': true,
|
||||
'url': OC.filePath('rainloop', 'ajax', sAjaxFile),
|
||||
'data': oForm.serialize(),
|
||||
'dataType': 'json',
|
||||
'global': true
|
||||
});
|
||||
|
||||
oDefAjax.always(function (oData) {
|
||||
|
||||
var bResult = false;
|
||||
|
||||
oForm.removeClass('rainloop-ajax');
|
||||
oSubmit.val(sSubmitValue);
|
||||
|
||||
if (oData)
|
||||
{
|
||||
bResult = 'success' === oData['status'];
|
||||
if (oData['Message'])
|
||||
{
|
||||
oDesc.text(oData['Message']);
|
||||
}
|
||||
}
|
||||
|
||||
if (bResult)
|
||||
{
|
||||
oForm.addClass('rainloop-success');
|
||||
}
|
||||
else
|
||||
{
|
||||
oForm.addClass('rainloop-error');
|
||||
if ('' === oDesc.text())
|
||||
{
|
||||
oDesc.text('Error');
|
||||
}
|
||||
}
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
fCallback(bResult, oData);
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
catch(e) {}
|
||||
}
|
||||
62
build/owncloud/rainloop-app/lib/RainLoopHelper.php
Normal file
62
build/owncloud/rainloop-app/lib/RainLoopHelper.php
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
class OC_RainLoop_Helper
|
||||
{
|
||||
public static function getSsoHash($sUrl, $sSsoKey, $sEmail, $sPassword, $sLogin = '')
|
||||
{
|
||||
if (!function_exists('curl_init'))
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
$oCurl = curl_init();
|
||||
curl_setopt_array($oCurl, array(
|
||||
CURLOPT_URL => $sUrl.'?ExternalSso',
|
||||
CURLOPT_HEADER => false,
|
||||
CURLOPT_FAILONERROR => true,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_USERAGENT => 'RainLoop SSO User Agent (ownCloud)',
|
||||
CURLOPT_POSTFIELDS => http_build_query(array(
|
||||
'SsoKey' => $sSsoKey,
|
||||
'Email' => $sEmail,
|
||||
'Password' => $sPassword,
|
||||
'Login' => $sLogin
|
||||
), '', '&'),
|
||||
CURLOPT_TIMEOUT => 5
|
||||
));
|
||||
|
||||
$mResult = curl_exec($oCurl);
|
||||
if (is_resource($oCurl))
|
||||
{
|
||||
curl_close($oCurl);
|
||||
}
|
||||
|
||||
return is_string($mResult) ? $mResult : '';
|
||||
}
|
||||
|
||||
public static function encodePassword($sPassword, $sSalt)
|
||||
{
|
||||
if (function_exists('mcrypt_encrypt') && function_exists('mcrypt_create_iv') && function_exists('mcrypt_get_iv_size') &&
|
||||
defined('MCRYPT_RIJNDAEL_256') && defined('MCRYPT_MODE_ECB') && defined('MCRYPT_RAND'))
|
||||
{
|
||||
return @trim(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($sSalt), $sPassword,
|
||||
MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND))));
|
||||
}
|
||||
|
||||
return @trim(base64_encode($sPassword));
|
||||
}
|
||||
|
||||
public static function decodePassword($sPassword, $sSalt)
|
||||
{
|
||||
if (function_exists('mcrypt_encrypt') && function_exists('mcrypt_create_iv') && function_exists('mcrypt_get_iv_size') &&
|
||||
defined('MCRYPT_RIJNDAEL_256') && defined('MCRYPT_MODE_ECB') && defined('MCRYPT_RAND'))
|
||||
{
|
||||
return @mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($sSalt), base64_decode(trim($sPassword)),
|
||||
MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND));
|
||||
}
|
||||
|
||||
return @base64_decode(trim($sPassword));
|
||||
}
|
||||
}
|
||||
39
build/owncloud/rainloop-app/personal.php
Normal file
39
build/owncloud/rainloop-app/personal.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ownCloud - RainLoop mail plugin
|
||||
*
|
||||
* @author RainLoop Team
|
||||
* @copyright 2014 RainLoop Team
|
||||
*
|
||||
* https://github.com/RainLoop/rainloop-webmail/tree/master/build/owncloud
|
||||
*/
|
||||
|
||||
OCP\User::checkLoggedIn();
|
||||
OCP\App::checkAppEnabled('rainloop');
|
||||
|
||||
OCP\Util::addScript('rainloop', 'personal');
|
||||
|
||||
$sUrl = trim(OCP\Config::getAppValue('rainloop', 'rainloop-url', ''));
|
||||
$sSsoKey = trim(OCP\Config::getAppValue('rainloop', 'rainloop-sso-key', ''));
|
||||
|
||||
if ('' === $sUrl || '' === $sSsoKey)
|
||||
{
|
||||
$oTemplate = new OCP\Template('rainloop', 'empty');
|
||||
}
|
||||
else
|
||||
{
|
||||
$sUser = OCP\User::getUser();
|
||||
|
||||
$oTemplate = new OCP\Template('rainloop', 'personal');
|
||||
|
||||
$sEmail = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-email', '');
|
||||
|
||||
$oTemplate->assign('rainloop-email', $sEmail);
|
||||
$oTemplate->assign('rainloop-login', OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-login', ''));
|
||||
|
||||
$sPass = OCP\Config::getUserValue($sUser, 'rainloop', 'rainloop-password', '');
|
||||
$oTemplate->assign('rainloop-password', 0 === strlen($sPass) && 0 === strlen($sEmail) ? '' : '******');
|
||||
}
|
||||
|
||||
return $oTemplate->fetchPage();
|
||||
23
build/owncloud/rainloop-app/templates/admin.php
Normal file
23
build/owncloud/rainloop-app/templates/admin.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<form id="mail-rainloop-admin-form" action="#" method="post">
|
||||
<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
|
||||
<input type="hidden" name="appname" value="rainloop">
|
||||
|
||||
<fieldset class="personalblock">
|
||||
<h2><?php p($l->t('RainLoop Webmail')); ?></h2>
|
||||
<br />
|
||||
<p>
|
||||
<?php p($l->t('RainLoop Webmail URL')); ?>:
|
||||
<br />
|
||||
<input type="text" style="width:300px;" id="rainloop-url" name="rainloop-url" value="<?php echo $_['rainloop-url']; ?>" placeholder="https://" />
|
||||
<br />
|
||||
<br />
|
||||
<?php p($l->t('SSO key')); ?>:
|
||||
<br />
|
||||
<input type="text" style="width:300px;" id="rainloop-url" name="rainloop-sso-key" value="<?php echo $_['rainloop-sso-key']; ?>" />
|
||||
<br />
|
||||
<br />
|
||||
<input type="button" id="rainloop-save-button" name="rainloop-save-button" value="<?php p($l->t('Save')); ?>" />
|
||||
<span class="rainloop-result-desc"></span>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
1
build/owncloud/rainloop-app/templates/empty.php
Normal file
1
build/owncloud/rainloop-app/templates/empty.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
<!-- empty -->
|
||||
1
build/owncloud/rainloop-app/templates/index-empty.php
Normal file
1
build/owncloud/rainloop-app/templates/index-empty.php
Normal file
|
|
@ -0,0 +1 @@
|
|||
EMPTY
|
||||
3
build/owncloud/rainloop-app/templates/index.php
Normal file
3
build/owncloud/rainloop-app/templates/index.php
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<div style="box-sizing: border-box; width: 100%; height: 100%; padding: 0 0 5px 5px; background-color: #383c43;">
|
||||
<iframe src="<?php echo $_['rainloop-url']; ?>" style="width: 100%; height: 100%;" tabindex="-1" frameBorder="0"></iframe>
|
||||
</div>
|
||||
18
build/owncloud/rainloop-app/templates/personal.php
Normal file
18
build/owncloud/rainloop-app/templates/personal.php
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<form id="mail-rainloop-personal-form" action="#" method="post">
|
||||
<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">
|
||||
<input type="hidden" name="appname" value="rainloop">
|
||||
|
||||
<fieldset class="personalblock">
|
||||
<h2><?php p($l->t('RainLoop Webmail')); ?></h2>
|
||||
<p>
|
||||
<input type="text" id="rainloop-email" name="rainloop-email"
|
||||
value="<?php echo $_['rainloop-email']; ?>" placeholder="<?php p($l->t('Email')); ?>" />
|
||||
|
||||
<input type="password" id="rainloop-password" name="rainloop-password"
|
||||
value="<?php echo $_['rainloop-password']; ?>" placeholder="<?php p($l->t('Password')); ?>" />
|
||||
|
||||
<input type="button" id="rainloop-save-button" name="rainloop-save-button" value="<?php p($l->t('Save')); ?>" />
|
||||
<span class="rainloop-result-desc"></span>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
|
@ -63,17 +63,19 @@ class Api
|
|||
* @param string $sEmail
|
||||
* @param string $sPassword
|
||||
* @param string $sLogin = ''
|
||||
* @param bool $bUseTimeout = true
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function GetUserSsoHash($sEmail, $sPassword, $sLogin = '')
|
||||
public static function GetUserSsoHash($sEmail, $sPassword, $sLogin = '', $bUseTimeout = true)
|
||||
{
|
||||
$sSsoHash = \sha1(\rand(10000, 99999).$sEmail.$sPassword.$sLogin.\microtime(true));
|
||||
|
||||
return self::Actions()->Cacher()->Set(self::Actions()->BuildSsoCacherKey($sSsoHash), \RainLoop\Utils::EncodeKeyValues(array(
|
||||
'Email' => $sEmail,
|
||||
'Password' => $sPassword,
|
||||
'Login' => $sLogin
|
||||
'Login' => $sLogin,
|
||||
'Time' => $bUseTimeout ? \time() : 0
|
||||
))) ? $sSsoHash : '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,8 @@ Enables caching in the system'),
|
|||
'custom_login_link' => array(''),
|
||||
'custom_logout_link' => array(''),
|
||||
'allow_external_login' => array(false),
|
||||
'allow_external_sso' => array(false),
|
||||
'external_sso_key' => array(''),
|
||||
'fast_cache_memcache_host' => array('127.0.0.1'),
|
||||
'fast_cache_memcache_port' => array(11211),
|
||||
'fast_cache_memcache_expire' => array(43200),
|
||||
|
|
|
|||
|
|
@ -749,7 +749,8 @@ class ServiceActions
|
|||
$mData = \RainLoop\Utils::DecodeKeyValues($sSsoSubData);
|
||||
$this->Cacher()->Delete($sSsoKey);
|
||||
|
||||
if (\is_array($mData) && !empty($mData['Email']) && isset($mData['Password']))
|
||||
if (\is_array($mData) && !empty($mData['Email']) && isset($mData['Password'], $mData['Time']) &&
|
||||
(0 === $mData['Time'] || \time() - 10 < $mData['Time']))
|
||||
{
|
||||
$sEmail = \trim($mData['Email']);
|
||||
$sPassword = $mData['Password'];
|
||||
|
|
@ -815,8 +816,8 @@ class ServiceActions
|
|||
|
||||
if ($this->oActions->Config()->Get('labs', 'allow_external_login', false))
|
||||
{
|
||||
$sEmail = trim($this->oHttp->GetRequest('Email', ''));
|
||||
$sLogin = trim($this->oHttp->GetRequest('Login', ''));
|
||||
$sEmail = \trim($this->oHttp->GetRequest('Email', ''));
|
||||
$sLogin = \trim($this->oHttp->GetRequest('Login', ''));
|
||||
$sPassword = $this->oHttp->GetRequest('Password', '');
|
||||
|
||||
try
|
||||
|
|
@ -867,6 +868,40 @@ class ServiceActions
|
|||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ServiceExternalSso()
|
||||
{
|
||||
$sKey = $this->oActions->Config()->Get('labs', 'external_sso_key', '');
|
||||
if ($this->oActions->Config()->Get('labs', 'allow_external_sso', false) &&
|
||||
!empty($sKey) && $sKey === \trim($this->oHttp->GetRequest('SsoKey', '')))
|
||||
{
|
||||
$sEmail = \trim($this->oHttp->GetRequest('Email', ''));
|
||||
$sLogin = \trim($this->oHttp->GetRequest('Login', ''));
|
||||
$sPassword = $this->oHttp->GetRequest('Password', '');
|
||||
|
||||
\RainLoop\Api::Handle();
|
||||
$sResult = \RainLoop\Api::GetUserSsoHash($sEmail, $sPassword, $sLogin);
|
||||
|
||||
switch (\strtolower($this->oHttp->GetRequest('Output', 'Plain')))
|
||||
{
|
||||
case 'plain':
|
||||
@\header('Content-Type: text/plain');
|
||||
return $sResult;
|
||||
|
||||
case 'json':
|
||||
@\header('Content-Type: application/json; charset=utf-8');
|
||||
return \MailSo\Base\Utils::Php2js(array(
|
||||
'Action' => 'ExternalSso',
|
||||
'Result' => $sResult
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
|||
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
8
rainloop/v/0.0.0/static/js/admin.min.js
vendored
File diff suppressed because one or more lines are too long
12
rainloop/v/0.0.0/static/js/app.min.js
vendored
12
rainloop/v/0.0.0/static/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue