diff --git a/helpers.lua b/helpers.lua index c53e783..2276c53 100644 --- a/helpers.lua +++ b/helpers.lua @@ -547,6 +547,7 @@ function get_data_for(view) local mails = get_mails(user) data = { connected = true, + theme = conf.theme, portal_url = conf.portal_url, uid = user, cn = cache:get(user.."-cn"), @@ -679,7 +680,7 @@ function edit_user() -- Open the LDAP connection local ldap = lualdap.open_simple(conf["ldap_host"], dn, args.currentpassword) - + local password = hash_password(args.newpassword) -- Modify the LDAP information @@ -906,7 +907,7 @@ function login() local uri_args = ngx.req.get_uri_args() args.user = string.lower(args.user) - + local user = authenticate(args.user, args.password) if user then ngx.status = ngx.HTTP_CREATED diff --git a/portal/assets/css/ynh-style.css b/portal/assets/css/ynh-style.css index 6b74919..c449282 100644 --- a/portal/assets/css/ynh-style.css +++ b/portal/assets/css/ynh-style.css @@ -133,6 +133,12 @@ img { text-align: center; margin-bottom: 0; opacity: 0.7; + width: 100px; + height: 100px; + background-image: url("../img/logo-ynh-white.svg"); + background-size: contain; + background-repeat: no-repeat; + background-position: center; } .logo img { diff --git a/portal/assets/js/ynhpanel.js b/portal/assets/js/ynhpanel.js index 855aa91..e7f38cf 100644 --- a/portal/assets/js/ynhpanel.js +++ b/portal/assets/js/ynhpanel.js @@ -223,13 +223,6 @@ domReady(function(){ meta_viewport = document.querySelector('meta[name="viewport"]'); meta_viewport_content = meta_viewport.getAttribute('content'); - // Add portal stylesheet - var portalStyle = document.createElement("link"); - portalStyle.setAttribute("rel", "stylesheet"); - portalStyle.setAttribute("type", "text/css"); - portalStyle.setAttribute("href", '/ynhpanel.css'); - document.getElementsByTagName("head")[0].insertBefore(portalStyle, null); - // Create portal link var portal = document.createElement('a'); portal.setAttribute('id', 'ynh-overlay-switch'); @@ -302,6 +295,26 @@ domReady(function(){ } } + + // Load all stylesheets after getting config + + // Add portal stylesheet + var portalStyle = document.createElement("link"); + portalStyle.setAttribute("rel", "stylesheet"); + portalStyle.setAttribute("type", "text/css"); + portalStyle.setAttribute("href", '/ynhpanel.css'); + document.getElementsByTagName("head")[0].insertBefore(portalStyle, null); + + // Custom style from theme + if (response.theme) { + var portalThemeStyle = document.createElement("link"); + portalThemeStyle.setAttribute("rel", "stylesheet"); + portalThemeStyle.setAttribute("type", "text/css"); + portalThemeStyle.setAttribute("href", '/yunohost/sso/assets/themes/'+ response.theme +'/css/ynhpanel.css'); + document.getElementsByTagName("head")[0].insertBefore(portalThemeStyle, null); + }; + + // Bind YNH Button window.addEvent(portal, 'click', function(e){ // Prevent default click diff --git a/portal/assets/themes/black/css/ynh-style.css b/portal/assets/themes/black/css/ynh-style.css new file mode 100644 index 0000000..a629e38 --- /dev/null +++ b/portal/assets/themes/black/css/ynh-style.css @@ -0,0 +1,12 @@ + +#logo { + z-index: 10; + background-image: url("../img/logo-ynh-white.svg"); +} + +.overlay { + background-color: black; + width: 100%; + height: 100%; + position: absolute; +} diff --git a/portal/assets/themes/black/css/ynhpanel.css b/portal/assets/themes/black/css/ynhpanel.css new file mode 100644 index 0000000..d723a53 --- /dev/null +++ b/portal/assets/themes/black/css/ynhpanel.css @@ -0,0 +1,11 @@ + +#ynh-overlay-switch { + background-image: url("../img/logo-ynh-white.svg"); +} + +#ynh-overlay { + background-color: black; + width: 100%; + height: 100%; + position: absolute; +} diff --git a/portal/assets/themes/black/img/logo-ynh-white.svg b/portal/assets/themes/black/img/logo-ynh-white.svg new file mode 100644 index 0000000..be75431 --- /dev/null +++ b/portal/assets/themes/black/img/logo-ynh-white.svg @@ -0,0 +1,32 @@ + + \ No newline at end of file diff --git a/portal/assets/themes/clouds/css/ynh-style.css b/portal/assets/themes/clouds/css/ynh-style.css new file mode 100644 index 0000000..0444392 --- /dev/null +++ b/portal/assets/themes/clouds/css/ynh-style.css @@ -0,0 +1,14 @@ + +#logo { + z-index: 10; + background-image: url("../img/logo-ynh.svg"); +} + +.overlay { + background-image: url("../img/background.jpg"); + width: 100%; + height: 100%; + position: absolute; + background-size: cover; + background-position: center; +} diff --git a/portal/assets/themes/clouds/css/ynhpanel.css b/portal/assets/themes/clouds/css/ynhpanel.css new file mode 100644 index 0000000..e32b5e9 --- /dev/null +++ b/portal/assets/themes/clouds/css/ynhpanel.css @@ -0,0 +1,13 @@ + +#ynh-overlay-switch { + background-image: url("../img/logo-ynh.svg"); +} + +#ynh-overlay { + background-image: url("../img/background.jpg"); + width: 100%; + height: 100%; + position: absolute; + background-size: cover; + background-position: center; +} diff --git a/portal/assets/themes/clouds/img/background.jpg b/portal/assets/themes/clouds/img/background.jpg new file mode 100644 index 0000000..32a876c Binary files /dev/null and b/portal/assets/themes/clouds/img/background.jpg differ diff --git a/portal/assets/themes/clouds/img/logo-ynh.svg b/portal/assets/themes/clouds/img/logo-ynh.svg new file mode 100644 index 0000000..409f5ad --- /dev/null +++ b/portal/assets/themes/clouds/img/logo-ynh.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/portal/header.ms b/portal/header.ms index f1b1776..e33ac3f 100644 --- a/portal/header.ms +++ b/portal/header.ms @@ -13,6 +13,9 @@ + {{#theme}} + + {{/theme}} @@ -35,7 +38,7 @@