Merge remote-tracking branch 'origin/support/3.0' into develop

# Conflicts:
#	lib/composer/autoload_files.php
#	lib/composer/autoload_static.php
#	templates/pages/backoffice/oauth/Wizard.html.twig
This commit is contained in:
Benjamin Dalsass
2022-06-27 08:38:01 +02:00
170 changed files with 2988 additions and 4456 deletions

View File

@@ -1,8 +0,0 @@
{# @copyright Copyright (C) 2010-2022 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<fieldset class="ibo-oauth-wizard--conf--panel ibo-oauth-wizard--result--panel">
<legend>{{ 'UI:OAuth:Wizard:ResultConf:Panel:Title'|dict_s }}</legend>
<p>{{ 'UI:OAuth:Wizard:ResultConf:Panel:Description'|dict_s }}</p>
<pre><code id="ibo-oauth-wizard--conf--result"></code></pre>
</fieldset>

View File

@@ -1,53 +0,0 @@
{# @copyright Copyright (C) 2010-2022 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
<div class="ibo-oauth-wizard">
<h1>{{ 'UI:OAuth:Wizard:Page:Title'|dict_s }}</h1>
<div class="ibo-oauth-wizard">
<div class="ibo-oauth-wizard--form--container">
<div id="select_layout">
{% set sIsChecked = 'checked' %}
{% for aSelect in aProviders %}
<input type="radio" name="provider" {{ sIsChecked }} value="{{ aSelect.name }}" id="layout_{{ aSelect.name }}" data-color1="{{ aSelect.colors.0 }}" data-color2="{{ aSelect.colors.1 }}" data-color3="{{ aSelect.colors.2 }}" data-color4="{{ aSelect.colors.3 }}">
<label for="layout_{{ aSelect.name }}">
<img src="{{ aSelect.icon }}" alt="{{ aSelect.name }}" class="ibo-dashboard--properties--icon" data-role="ibo-dashboard--properties--icon"/>
</label>
{% set sIsChecked = '' %}
{% endfor %}
</div>
</div>
<fieldset>
<legend>{{ 'UI:OAuth:Wizard:Form:Panel:Title'|dict_s }}</legend>
<form class="ibo-oauth-wizard--form">
<input type="hidden" name="url" value="">
{% for sName, aInput in aInputs %}
<div class="details">
<div class="field_container field_small">
<div class="field_label label"><label for="wizard_input_{{ sName }}">{{ aInput.label }}</label></div>
<div class="field_data">
<input
type="{{ aInput.type }}"
id="wizard_input_{{ sName }}"
name="{{ sName }}"
{% if aInput.read_only %} readonly {% endif %}
value="{{ aInput.value }}"
size="100"
>
</div>
</div>
</div>
{% endfor %}
<button class="ibo-oauth-wizard--form--submit" type="submit">{{ 'UI:OAuth:Wizard:Form:Button:Submit:Label'|dict_s }}</button>
</form>
</fieldset>
</div>
{% for sTemplate in aAdditionalBlocks %}
{% include sTemplate %}
{% endfor %}
</div>

View File

@@ -1,131 +0,0 @@
// Function used to open OAuth popup
var oWindowObjectReference = null;
var sPreviousUrl = null;
var oListener = null
const oOnOauthSuccess = function (event){
clearInterval(oListener);
$.post(
'{{ sAjaxUri }}',
{
operation: 'GetDisplayAuthenticationResults',
provider: $('[name="provider"]:checked').val(),
client_id: $('[name="client_id"]').val(),
client_secret: $('[name="client_secret"]').val(),
scope: $(this).find('[name="scope"]').val(),
additional: $(this).find('[name="additional"]').val(),
redirect_url: event.data
},
function(oData){
if(oData.status == 'success')
{
oData.data.forEach(function(item, index){
new Function(item)();
});
}
$('.ibo-oauth-wizard--form--submit').prop('disabled', false);
}
);
}
const oOpenSignInWindow = function (url, name){
// Remove any existing event listener
window.removeEventListener('message', oOnOauthSuccess);
if(oListener !== null){
clearInterval(oListener);
}
// Window features
const sWindowFeatures = 'toolbar=no, menubar=no, width=600, height=700, top=100, left=100';
if (oWindowObjectReference === null || oWindowObjectReference.closed) {
/* If the pointer to the window object in memory does not exist
or if such pointer exists but the window was closed */
oWindowObjectReference = window.open(url, name, sWindowFeatures);
} else if (sPreviousUrl !== url) {
/* If the resource to load is different,
then we load it in the already opened secondary window, and then
we bring such window back on top/in front of its parent window. */
oWindowObjectReference = window.open(url, name, sWindowFeatures);
oWindowObjectReference.focus();
} else {
/* Else the window reference must exist and the window
is not closed; therefore, we can bring it back on top of any other
window with the focus() method. There would be no need to re-create
the window or to reload the referenced resource. */
oWindowObjectReference.focus();
}
/* Let know every second our child window that we're waiting for it to complete,
once we reach our landing page, it'll send us a reply
*/
oListener = window.setInterval(function(){
if (oWindowObjectReference.closed) {
$('.ibo-oauth-wizard--form--submit').prop('disabled', false);
clearInterval(oListener);
}
oWindowObjectReference.postMessage('anyone', '{{ sReturnUri }}');
}, 1000);
/* Once we receive a response, transmit it to the server to get authenticate and display
results
*/
window.addEventListener('message', oOnOauthSuccess, false);
// Assign the previous URL
sPreviousUrl = url;
};
// Function used when the form is submitted
const oOnFormSubmit = function(){
$('.ibo-oauth-wizard--form--submit').prop('disabled', true);
$.post(
'{{ sAjaxUri }}',
{
operation: 'GetAuthorizationUrl',
provider: $('[name="provider"]:checked').val(),
client_id: $(this).find('[name="client_id"]').val(),
client_secret: $(this).find('[name="client_secret"]').val(),
scope: $(this).find('[name="scope"]').val(),
additional: $(this).find('[name="additional"]').val()
},
function(oData){
if(oData.status == 'success')
{
oOpenSignInWindow(oData.data.authorization_url, 'OAuth authorization')
}
else{
$('.ibo-oauth-wizard--form--submit').prop('disabled', false);
}
}
);
return false;
}
// Function used to update provider image
function oUpdateProviderImage(elem){
var oColor1 = $(elem).prev('[name="provider"]').attr('data-color1');
var oColor2 = $(elem).prev('[name="provider"]').attr('data-color2');
var oColor4 = $(elem).prev('[name="provider"]').attr('data-color3');
var oColor3 = $(elem).prev('[name="provider"]').attr('data-color4');
$('#fcef55fc-4968-45b2-93bb-1a1080c85fc7').attr('fill', oColor1);
$('#e8fa0310-b872-4adf-aedd-0c6eda09f3b8').attr('fill', oColor1);
$('#a4813fcf-056e-4514-bb8b-e6506f49341f').attr('fill', oColor1);
$('#e73810fe-4cf4-40cc-8c7c-ca544ce30bd4-108').attr('fill', oColor2);
$('#e12ee00d-aa4a-4413-a013-11d20b7f97f7').attr('fill', oColor2);
$('#b4d4939a-c6e6-4f4d-ba6c-e8b05485017d').attr('fill', oColor2);
$('#b06d66ec-6c84-45dd-8c27-1263a6253192-107').attr('fill', oColor3);
$('#f58f497e-6949-45c8-be5f-eee2aa0f6586').attr('fill', oColor3);
$('#aff120b1-519b-4e96-ac87-836aa55663de').attr('fill', oColor3);
$('#ae7af94f-88d7-4204-9f07-e3651de85c05-111').attr('fill', oColor4);
$('#a6768b0e-63d0-4b31-8462-9b2e0b00f0fd-112').attr('fill', oColor4);
}
$('body').on('click', '.ui-checkboxradio-radio-label', function(){
oUpdateProviderImage(this)
})
oUpdateProviderImage($('[name="provider"]:checked').next());
// Initialize provider buttons
$('#select_layout').buttonset();
$('.ibo-oauth-wizard--form').on('submit', oOnFormSubmit);