The authentication itself goes fine with that one, but the custom login
form template I was using, became lost in the process, so I have
attempted to put it on a themes module.
(BTW, the modules page doesn't look very illustrative about those moves.
At first glance is not clear where should I put my templates: maybe in a
templates/ directory on sqlauth? within a theme module? Why not just to
use a /themes/ directory on the simplesamlphp root level instead of that
convoluted "modules/<thememodule>/themes/<theme>/<module>/<template>" path?)
Anyway, I was able finally to put my login form template in a
modules/custom/themes/avgreen/core/ path to replace the core
loginuserpass.php one and it displays right on login. My images and css
sheets run fine, too (they are in www/resources/ yet, however. Maybe
I'll have to look soon for another location).
However, the translation of texts and prompts fails and I get those "not
translated (login:username)" instead. It looks as the dictionaries
lookup fails while using a module theme.
Any ideas?
José Alfonso.
(BTW, the modules page doesn't look very illustrative about those moves.
At first glance is not clear where should I put my templates: maybe in a
templates/ directory on sqlauth? within a theme module? Why not just to
use a /themes/ directory on the simplesamlphp root level instead of that
convoluted "modules/<thememodule>/themes/<theme>/<module>/<template>" path?)
Anyway, I was able finally to put my login form template in a
modules/custom/themes/avgreen/core/ path to replace the core
loginuserpass.php one and it displays right on login. My images and css
sheets run fine, too (they are in www/resources/ yet, however. Maybe
I'll have to look soon for another location).
However, the translation of texts and prompts fails and I get those "not
translated (login:username)" instead. It looks as the dictionaries
lookup fails while using a module theme.
> Let me know if this document makes sense to you:
> http://rnd.feide.no/content/theming-simplesamlphp
Yes, of course. Actually, the mode you tell about in "Creating your
first theme" is the same one I was using before moving the
authentication to the modules approach.
Let us see it:
If I'm right, there are three sites, at least, to put our own
templates: in a theme directory in templates/ (in simplesamlphp root),
in a templates/ directory within the module, or in a custom theme module.
I have removed my PostgreSQL authentication plugin to start using the
included sqlauth module.
As soon as I configure our IdP to use the sqlauth module (after
setting config/authsources.php), the login process doesn't use the
files from the main templates/ directory anymore, where I had my
templates until now, but those from modules/core/templates.
Then, it seems that choosing to use the sqlauth module means I'm
forced to use the templates included in modules/core/templates/ as
well... or override them with a theme module. If I'm right, this is a
point that should be clearer in the documentation: what templates to
use with the modules or how to deal with modules when there is an
general custom theme in use.
So, although I had my custom theme defined in main templates/custom,
given that I want to use the sqlauth module, I have now to override
loginuserpass.php (not login.php) with something as
modules/custom/themes/avgreen/core/loginuserpass.php.
Any other alternative, as setting 'theme.use' =>'custom' and putting
loginuserpass.php template in the main templates/custom/ directory
triggers an error as:
Jan 02 13:04:10 simpleSAMLphp 6 [5873c9b460]
/simplesaml/module.php/core/loginuserpass.php - Template: Could not
find template file [core:loginuserpass.php] at
[/usr/local/www/simplesamlphp/modules/core/templates/custom/loginuserpass.php]
- now trying the base template
As you see, it's looking for loginuserpass.php template, but NOT in
the main templates/custom/ directory, where it is, but within the core
module itself.
This seems to mean also setting 'theme.use' => 'custom:avgreen' in
config.php, but then all remaining templates in the main
templates/custom are lost.
(IMHO, if 'theme.use' does not indicate a module with :, we should
look first an the main templates directory. Maybe we could use
'theme.use' =>':custom' to mean within the core module, so leaving
'theme.use' =>'custom' for the main one...)
> Translation relates to the dictionaries/ files. If you want to override
> the login template in your theme in general you shold not need to modify
> the language tags, but reuse the ones that exists there.
My loginuserpass.php template (in modules/custom/themes/avgreen/core/)
uses standard tags, as $this->t('login:user_pass_header'), so it
shouldn't need any special dictionary, but the standard one.
(login.php, in this case, it isn't?)
Any pointers about where to look in depth about that?
Thanks,
JA.
--
José Alfonso Accino
IT Systems Management
Central Computing Services
University of Málaga -Spain-
[snipp]
Jan 02 13:04:10 simpleSAMLphp 6 [5873c9b460]
/simplesaml/module.php/core/loginuserpass.php - Template: Could not
find template file [core:loginuserpass.php] at
[/usr/local/www/simplesamlphp/modules/core/templates/custom/loginuserpass.php]
- now trying the base template
As you see, it's looking for loginuserpass.php template, but NOT in
the main templates/custom/ directory, where it is, but within the core
module itself.
This seems to mean also setting 'theme.use' => 'custom:avgreen' in
config.php, but then all remaining templates in the main
templates/custom are lost.
(IMHO, if 'theme.use' does not indicate a module with :, we should
look first an the main templates directory. Maybe we could use
'theme.use' =>':custom' to mean within the core module, so leaving
'theme.use' =>'custom' for the main one...)
Translation relates to the dictionaries/ files. If you want to overridethe login template in your theme in general you shold not need to modifythe language tags, but reuse the ones that exists there.
My loginuserpass.php template (in modules/custom/themes/avgreen/core/)
uses standard tags, as $this->t('login:user_pass_header'), so it
shouldn't need any special dictionary, but the standard one.
(login.php, in this case, it isn't?)
Any pointers about where to look in depth about that?
[...]
>
> You have created your own module 'custom', which includes a theme named
> 'avgreen'. Then you have a directory structure like this:
>
> simplesamlphp/modules/custom includes:
> ./default-enable
> ./themes
> ./themes/avgreen
> ./themes/avgreen/core
> ./themes/avgreen/core/loginuserpass.php
> ./themes/avgreen/default
> ./themes/avgreen/default/includes
> ./themes/avgreen/default/includes/header.php
> ./themes/avgreen/openid
> ./themes/avgreen/openid/consumer.php
No problem with a such scheme. Just a drawback, however: it looks as
I'd have to copy that 'default' subfolder into each new theme...
> Let me know if this works for you...?
Yes, the themes issue seems solved :-)
> 'login:user_pass_header',
> will lookup the 'user_pass_header' header in the dictionary:
> 'simplesamlphp/dictionaries/login.php'
>
> 'custom:login:user_pass_header'
> will lookup the 'user_pass_header' header in the dictionary:
> 'simplesamlphp/modules/custom/dictionaries/login.php'
>
> Which means you cannot override dictionaries inside a custom module for
> built-in templates.
I see now... However, I have done it so but it doesn't work. I have a
login.php dictionary in modules/custom/dictionaries/ (just a copy of
the default one):
#ll modules/custom/dictionaries/
total 18
-rw-r--r-- 1 www wheel 17589 5 ene 09:29 login.php
And I have modified the tags, as well, pointing to that custom dictionary:
<label><?php echo $this->t('custom:login:user_pass_text'); ?></label>
But I keep getting the "not translated (custom:login:user_pass_text)"
messages yet. This is the log:
Jan 05 10:20:00 simpleSAMLphp 6 [ee165364a6] Template: Looking up
[custom:login:user_pass_header]: not translated at all.
Jan 05 10:20:00 simpleSAMLphp 6 [ee165364a6] Template: Looking up
[custom:login:user_pass_text]: not translated at all.
Jan 05 10:20:00 simpleSAMLphp 6 [ee165364a6] Template: Looking up
[custom:login:username]: not translated at all.
Jan 05 10:20:00 simpleSAMLphp 6 [ee165364a6] Template: Looking up
[custom:login:password]: not translated at all.
Hmm, what do you mean? It should not be neccessary to move any default
templates, unless you want to modify them? Be sure that you do not
modify the
'theme.base' => 'default',
>> Which means you cannot override dictionaries inside a custom module
>> for
>> built-in templates.
>
> I see now... However, I have done it so but it doesn't work. I have a
> login.php dictionary in modules/custom/dictionaries/ (just a copy of
> the default one):
Hmm, can you try:
<?php echo $this->t('{custom:login:user_pass_text}'); ?>
and see if that works?
Yes, now it works! :-)
Thanks!