mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-06-24 20:01:36 +02:00
Fix egw message in login page is not removable
This commit is contained in:
parent
5c08a266c1
commit
f671009c3d
@ -452,6 +452,8 @@ window.app = {classes: {}};
|
|||||||
//
|
//
|
||||||
window.egw_LAB.wait = window.egw_ready.then;
|
window.egw_LAB.wait = window.egw_ready.then;
|
||||||
|
|
||||||
|
// dispatch egw-is-created event in order to let login.js knows about egw object readiness
|
||||||
|
document.dispatchEvent(new Event('egw-is-created'));
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
142
api/js/login.js
142
api/js/login.js
@ -20,86 +20,88 @@ catch (exception){
|
|||||||
alert('Your browser is not up-to-date (JavaScript ES2020 compatible), you may experience some of the features not working.');
|
alert('Your browser is not up-to-date (JavaScript ES2020 compatible), you may experience some of the features not working.');
|
||||||
}
|
}
|
||||||
|
|
||||||
egw_ready.then(function()
|
// listen to egw-is-created object to make sure egw object is ready
|
||||||
{
|
document.addEventListener('egw-is-created', function(){
|
||||||
jQuery(document).ready(function()
|
egw_ready.then(function()
|
||||||
{
|
{
|
||||||
// lock the device orientation in portrait view
|
jQuery(document).ready(function()
|
||||||
if (screen.orientation && typeof screen.orientation.lock == 'function') screen.orientation.lock('portrait');
|
|
||||||
jQuery('.close').click(function (){
|
|
||||||
setTimeout(function(){jQuery('.egw_message_wrapper').slideUp("slow");},100);
|
|
||||||
});
|
|
||||||
function do_social(_data)
|
|
||||||
{
|
{
|
||||||
var social = jQuery(document.createElement('div'))
|
// lock the device orientation in portrait view
|
||||||
.attr({
|
if (screen.orientation && typeof screen.orientation.lock == 'function') screen.orientation.lock('portrait');
|
||||||
id: "socialMedia",
|
jQuery('.close').click(function (){
|
||||||
class: "socialMedia"
|
setTimeout(function(){jQuery('.egw_message_wrapper').slideUp("slow");},100);
|
||||||
})
|
});
|
||||||
.appendTo(jQuery('#socialBox'));
|
function do_social(_data)
|
||||||
|
|
||||||
for(var i=0; i < _data.length; ++i)
|
|
||||||
{
|
{
|
||||||
var data = _data[i];
|
var social = jQuery(document.createElement('div'))
|
||||||
var url = (data.lang ? data.lang[jQuery('meta[name="language"]').attr('content')] : null) || data.url;
|
.attr({
|
||||||
jQuery(document.createElement('a')).attr({
|
id: "socialMedia",
|
||||||
href: url,
|
class: "socialMedia"
|
||||||
target: '_blank'
|
})
|
||||||
})
|
.appendTo(jQuery('#socialBox'));
|
||||||
.appendTo(social)
|
|
||||||
.append(jQuery(document.createElement('img'))
|
for(var i=0; i < _data.length; ++i)
|
||||||
.attr('src', data.svg));
|
{
|
||||||
|
var data = _data[i];
|
||||||
|
var url = (data.lang ? data.lang[jQuery('meta[name="language"]').attr('content')] : null) || data.url;
|
||||||
|
jQuery(document.createElement('a')).attr({
|
||||||
|
href: url,
|
||||||
|
target: '_blank'
|
||||||
|
})
|
||||||
|
.appendTo(social)
|
||||||
|
.append(jQuery(document.createElement('img'))
|
||||||
|
.attr('src', data.svg));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
do_social([
|
do_social([
|
||||||
{ "svg": egw_webserverUrl+"/api/templates/default/images/logo164x164.svg", "url": "https://www.egroupware.org/en", "lang": { "de": "https://www.egroupware.org/de/" }},
|
{ "svg": egw_webserverUrl+"/api/templates/default/images/logo164x164.svg", "url": "https://www.egroupware.org/en", "lang": { "de": "https://www.egroupware.org/de/" }},
|
||||||
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_contact.svg", "url": "https://www.egroupware.org/en/contact.html", "lang": { "de": "https://www.egroupware.org/de/kontakt.html" }},
|
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_contact.svg", "url": "https://www.egroupware.org/en/contact.html", "lang": { "de": "https://www.egroupware.org/de/kontakt.html" }},
|
||||||
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_facebook.svg", "url": "https://www.facebook.com/egroupware" },
|
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_facebook.svg", "url": "https://www.facebook.com/egroupware" },
|
||||||
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_twitter.svg", "url": "https://twitter.com/egroupware" },
|
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_twitter.svg", "url": "https://twitter.com/egroupware" },
|
||||||
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_discourse.svg", "url": "https://help.egroupware.org" },
|
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_discourse.svg", "url": "https://help.egroupware.org" },
|
||||||
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_github.svg", "url": "https://github.com/EGroupware/egroupware" }
|
{ "svg": egw_webserverUrl+"/api/templates/default/images/login_github.svg", "url": "https://github.com/EGroupware/egroupware" }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// automatic submit of SAML IdP selection
|
// automatic submit of SAML IdP selection
|
||||||
jQuery('select[name="auth=saml"]').on('change', function() {
|
jQuery('select[name="auth=saml"]').on('change', function() {
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
|
this.form.method = 'get';
|
||||||
|
jQuery(this.form).append('<input type="hidden" name="auth" value="saml"/>');
|
||||||
|
jQuery(this.form).append('<input type="hidden" name="idp" value="'+this.value+'"/>');
|
||||||
|
this.form.submit();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// or optional SAML login with a button for a single IdP
|
||||||
|
jQuery('input[type="submit"][name="auth=saml"]').on('click', function(){
|
||||||
this.form.method = 'get';
|
this.form.method = 'get';
|
||||||
jQuery(this.form).append('<input type="hidden" name="auth" value="saml"/>');
|
jQuery(this.form).append('<input type="hidden" name="auth" value="saml"/>');
|
||||||
jQuery(this.form).append('<input type="hidden" name="idp" value="'+this.value+'"/>');
|
});
|
||||||
this.form.submit();
|
// prefer [Login] button below over maybe existing SAML login button above
|
||||||
}
|
jQuery('input').on('keypress', function(e)
|
||||||
});
|
|
||||||
// or optional SAML login with a button for a single IdP
|
|
||||||
jQuery('input[type="submit"][name="auth=saml"]').on('click', function(){
|
|
||||||
this.form.method = 'get';
|
|
||||||
jQuery(this.form).append('<input type="hidden" name="auth" value="saml"/>');
|
|
||||||
});
|
|
||||||
// prefer [Login] button below over maybe existing SAML login button above
|
|
||||||
jQuery('input').on('keypress', function(e)
|
|
||||||
{
|
|
||||||
if (e.which == 13)
|
|
||||||
{
|
{
|
||||||
this.form.submit();
|
if (e.which == 13)
|
||||||
return false;
|
{
|
||||||
}
|
this.form.submit();
|
||||||
});
|
return false;
|
||||||
//cleanup darkmode session value
|
}
|
||||||
egw.setSessionItem('api', 'darkmode','');
|
});
|
||||||
|
//cleanup darkmode session value
|
||||||
|
egw.setSessionItem('api', 'darkmode','');
|
||||||
|
|
||||||
jQuery(".tooltip", "#login_footer").on('click', function(e){
|
jQuery(".tooltip", "#login_footer").on('click', function(e){
|
||||||
if (e.target == this) window.open(this.getElementsByTagName('a')[0].href, 'blank');
|
if (e.target == this) window.open(this.getElementsByTagName('a')[0].href, 'blank');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
// register service worker
|
||||||
|
if ('serviceWorker' in navigator) {
|
||||||
|
navigator.serviceWorker.register('./service-worker.js', {scope:egw_webserverUrl+'/'})
|
||||||
|
.then(function(registration) {
|
||||||
|
console.log('Registration successful, scope is:', registration.scope);
|
||||||
|
})
|
||||||
|
.catch(function(error) {
|
||||||
|
console.log('Service worker registration failed, error:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// register service worker
|
|
||||||
if ('serviceWorker' in navigator) {
|
|
||||||
navigator.serviceWorker.register('./service-worker.js', {scope:egw_webserverUrl+'/'})
|
|
||||||
.then(function(registration) {
|
|
||||||
console.log('Registration successful, scope is:', registration.scope);
|
|
||||||
})
|
|
||||||
.catch(function(error) {
|
|
||||||
console.log('Service worker registration failed, error:', error);
|
|
||||||
});
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user