<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
Hi Felix,
<div class=""><br class="">
</div>
<div class=""> Understood.</div>
<div class=""><br class="">
</div>
<div class="">I’ve created a ticket for adding support for an omero.web.login_template </div>
<div class=""><a href="https://trello.com/c/1Z8Ngaw8/237-omeroweblogintemplate" class="">https://trello.com/c/1Z8Ngaw8/237-omeroweblogintemplate</a></div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class=""><br class="">
</div>
<div class="">   Will.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 16 Aug 2017, at 10:18, MEYENHOFER Felix <<a href="mailto:felix.meyenhofer@unifr.ch" class="">felix.meyenhofer@unifr.ch</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">Hi Will <br class="">
<br class="">
the thing is that actually I am fine with the view logic. But I would like to add some information to the page.
<br class="">
I checked <br class="">
<a href="https://docs.openmicroscopy.org/omero/5.3.3/sysadmins/config.html#web" class="">https://docs.openmicroscopy.org/omero/5.3.3/sysadmins/config.html#web</a><br class="">
and the only template to change (add) is the index.html.<br class="">
<br class="">
I would like to have a custom login.html, preferably via configurations, so I can keep it separate from the OMERO code. So the simplest way I can think of would be to set<br class="">
omero.web.login_template<br class="">
in the configurations, but this parameter does not exist according to the docs.<br class="">
<br class="">
<br class="">
However, I resolved for the static solution you proposed for now. This works fine, I hope it will keep doing so.<br class="">
<br class="">
Thanks <br class="">
<br class="">
Felix<br class="">
<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">On 15 Aug 2017, at 13:53, William Moore (Staff) <W.Moore@dundee.ac.uk> wrote:<br class="">
<br class="">
Hi Felix,<br class="">
<br class="">
You’ll probably also want to update the “login_view” which is the login page that users<br class="">
are redirected to when they try to visit a page that requires a login (when they are not already logged in).<br class="">
<br class="">
This will set it to the “webindex_custom” page that is used to show your custom index_template.<br class="">
<br class="">
$ bin/omero config set omero.web.login_view “webindex_custom"<br class="">
<br class="">
Now, when users visit e.g.  /webclient/ and are not logged in, they’ll get to see your custom login page<br class="">
instead of the regular login page.<br class="">
<br class="">
Hope that helps,<br class="">
<br class="">
 Will.<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">On 15 Aug 2017, at 11:07, William Moore (Staff) <W.Moore@dundee.ac.uk> wrote:<br class="">
<br class="">
Hi Felix,<br class="">
<br class="">
I’m afraid our documentation on these settings is probably not as clear as it should be (and is actually incorrect - see below).<br class="">
<br class="">
When you say "I use the custom login setting”, could you tell me what bin/omero config setting you used?<br class="">
<br class="">
Do you mean: bin/omero config set omero.web.index_template 'mytemplate/index.html'<br class="">
<br class="">
This setting is not for login page (I think the screenshot there is confusing).<br class="">
The index_template can be used to provide a custom page for the /index/ location of your OMERO.web.<br class="">
<br class="">
If you do:<br class="">
<br class="">
bin/omero config set omero.web.index_template ‘webclient/index.html'<br class="">
This uses the example template at<br class="">
https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroWeb/omeroweb/webclient/templates/webclient/index.html<br class="">
<br class="">
Restart your web and visit /index/ of your OMERO.web and you will see the example page.<br class="">
<br class="">
If you want to customise this, you can copy that example and tweak the contents (e.g. if I only have this code in my ‘login’ block:<br class="">
<br class="">
{% block login %}<br class="">
 <form><br class="">
   <h2>Custom Login Page</h2><br class="">
 </form><br class="">
{% endblock %}<br class="">
<br class="">
Then save this in a new location, e.g. on my Desktop/custom_index.html:<br class="">
<br class="">
Then I can config: NB: this is INCORRECT in the docs. We’ll fix that ASAP.<br class="">
<br class="">
NB: single and double quotes<br class="">
$ bin/omero config append omero.web.template_dirs '"/Users/wmoore/Desktop"'<br class="">
<br class="">
$ bin/omero config set omero.web.index_template “custom_index.html"<br class="">
<br class="">
Restart web and now I see this at /index/<br class="">
<br class="">
<Screen Shot 2017-08-15 at 10.12.46.png><br class="">
<br class="">
<br class="">
If you want to create your own custom login page, you can manually add the <form> fields to your custom template.<br class="">
WARNINGS:<br class="">
- This will mean that these elements will be hard-coded and won’t update as the original login form does (e.g. won’t show a dynamic list of servers in the drop-down list).<br class="">
- Also, it could easily break for new releases of OMERO.web that may use different form elements or names.<br class="">
- You need to include the {% csrf_token %} tag to dynamically add the CSRF token required for login<br class="">
<br class="">
For example, this code works for me using current development version of OMERO, giving a form that looks the same as the original (without the ssl checkbox).<br class="">
<br class="">
{% block login %}<br class="">
<form class="standard_form inlined" action="/webclient/login/?url=%2Fwebclient%2F" method="post"><br class="">
 {% csrf_token %}<br class="">
 <div id="choose_server"><br class="">
   <select id="id_server" name="server"><br class="">
     <option value="1">omero:4064</option><br class="">
   </select><br class="">
 </div><br class="">
 <div><br class="">
   <label for="id_username">Username:</label><br class="">
   <input autofocus="autofocus" id="id_username" maxlength="50" name="username" size="22" type="text" /><br class="">
 </div><br class="">
 <div><br class="">
   <label for="id_password">Password:</label><br class="">
   <input autocomplete="off" id="id_password" maxlength="50" name="password" size="22" type="password" /><br class="">
 </div><br class="">
 <input type="submit" value="Login" /><br class="">
 <div><br class="">
   <p><a href="/webadmin/forgottenpassword/">Forgot your password?</a></p><br class="">
 </div><br class="">
</form><br class="">
{% endblock %}<br class="">
<br class="">
<br class="">
If you are happy to test your form before each upgrade of OMERO then this approach should work OK for you.<br class="">
<br class="">
I’ll update our docs to fix the bug and make this setting clearer,<br class="">
<br class="">
Regards,<br class="">
<br class="">
 Will.<br class="">
<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">On 14 Aug 2017, at 18:18, MEYENHOFER Felix <felix.meyenhofer@unifr.ch> wrote:<br class="">
<br class="">
Hey Will<br class="">
<br class="">
thanks for the info.<br class="">
<br class="">
I use the custom login setting. But this is not picked up either in the context for the index page.<br class="">
<br class="">
What confuses me a bit, is that in the example of the customization <br class="">
https://docs.openmicroscopy.org/omero/5.3.3/sysadmins/customization.html#index-page<br class="">
... the login form seems to work.<br class="">
<br class="">
in the current state of OMERO.web would this require modification of the index view, would it not?<br class="">
<br class="">
Felix<br class="">
<br class="">
<blockquote type="cite" class="">On 31 Jul 2017, at 14:49, William Moore (Staff) <W.Moore@dundee.ac.uk> wrote:<br class="">
<br class="">
Hi Felix,<br class="">
<br class="">
One option to make smaller customisations of the login page is to add a custom logo: See https://docs.openmicroscopy.org/omero/5.3.3/sysadmins/config.html#omero-web-login-logo.<br class="">
<br class="">
Otherwise, if you want a more-customised login page, you’ll have to add the form elements to your template instead of using {{ block super }}.<br class="">
<br class="">
Let us know if you have any more details on what you’d like to achieve,<br class="">
<br class="">
Regards,<br class="">
<br class="">
Will.<br class="">
<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">On 21 Jul 2017, at 21:15, William Moore (Staff) <wmoore@dundee.ac.uk> wrote:<br class="">
<br class="">
Hi Felix,<br class="">
<br class="">
If you want to display the login form, then this needs to be included in the context that<br class="">
is used to render the page.<br class="">
<br class="">
See the context that is prepared in ‘handle_not_logged_in()’ at<br class="">
https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroWeb/omeroweb/webclient/views.py#L220<br class="">
which includes several variables required by the login page, including the LoginForm required within the {% block login %}.<br class="">
<br class="">
As you can see here, the Custom page doesn’t include any of these in it’s context.<br class="">
https://github.com/openmicroscopy/openmicroscopy/blob/develop/components/tools/OmeroWeb/omeroweb/webclient/views.py#L149<br class="">
<br class="">
I’m away on holiday this week, but can give your requirements a bit more thought when I’m back next week…<br class="">
<br class="">
Regards,<br class="">
<br class="">
Will.<br class="">
<br class="">
<br class="">
<br class="">
<br class="">
<blockquote type="cite" class="">On 21 Jul 2017, at 11:53, MEYENHOFER Felix <felix.meyenhofer@unifr.ch> wrote:<br class="">
<br class="">
Hi<br class="">
<br class="">
I was playing around with the customization of the web templates. There is the possibility to set a custom index page:;<br class="">
https://www-legacy.openmicroscopy.org/site/support/omero5.3/sysadmins/customization.html#index-page<br class="">
<br class="">
So I went and used the webclient/index.html template, which works fine. But then I tried to add the login form on the same page by inserting
<br class="">
{{ block.super }}<br class="">
into the (% block login %} <br class="">
<br class="">
the result is not quite what I expected (see screenshot)<br class="">
https://drive.switch.ch/index.php/s/lTL00RDleui3XFC<br class="">
When inspecting the page source code, there are comments <!--Form Error-->, where the fields from the login form should appear.
<br class="">
<br class="">
I could not find anything in the omero.web logs nor in the nginx logs. <br class="">
<br class="">
Is there another easy explanation for this?<br class="">
<br class="">
Best, <br class="">
<br class="">
Felix<br class="">
_______________________________________________<br class="">
ome-users mailing list<br class="">
ome-users@lists.openmicroscopy.org.uk<br class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users<br class="">
</blockquote>
<br class="">
</blockquote>
<br class="">
<br class="">
The University of Dundee is a registered Scottish Charity, No: SC015096<br class="">
_______________________________________________<br class="">
ome-users mailing list<br class="">
ome-users@lists.openmicroscopy.org.uk<br class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users<br class="">
</blockquote>
<br class="">
_______________________________________________<br class="">
ome-users mailing list<br class="">
ome-users@lists.openmicroscopy.org.uk<br class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users<br class="">
</blockquote>
<br class="">
<br class="">
The University of Dundee is a registered Scottish Charity, No: SC015096<br class="">
_______________________________________________<br class="">
ome-users mailing list<br class="">
ome-users@lists.openmicroscopy.org.uk<br class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users<br class="">
</blockquote>
<br class="">
<br class="">
The University of Dundee is a registered Scottish Charity, No: SC015096<br class="">
_______________________________________________<br class="">
ome-users mailing list<br class="">
ome-users@lists.openmicroscopy.org.uk<br class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users<br class="">
</blockquote>
<br class="">
_______________________________________________<br class="">
ome-users mailing list<br class="">
ome-users@lists.openmicroscopy.org.uk<br class="">
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
<br>
<span style="font-size:10pt;">The University of Dundee is a registered Scottish Charity, No: SC015096</span>
</body>
</html>