Looks like the form comes from django_openstack_auth:
https://github.com/openstack/django_openstack_auth/blob/master/openstack_auth/forms.py#L53


But to be honest, no idea how that can be overridden trough the themes, not sure if its even possible to override anything on that page without modifying django_openstack_auth directly :(

Maybe someone else has a better insight on this than me.


* Horrible Hack Incoming, read at your own discretion *

You can override the template here:
https://github.com/openstack/horizon/blob/master/horizon/templates/horizon/common/_form_field.html#L51

And change this line:
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{{ field.label }}</label>

For this:
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}" for="{{ field.auto_id }}">{% if field.label == "User Name" and not request.user.is_authenticated %}Email{% else %}{{ field.label }}{% endif %}</label>


Which will check if the label is "User Name" and the user is logged out and directly write "Email" as the field label.

I know, its horrible and if you update horizon it will be overriden, but probably works for the time being if you really need it ¯\_(ツ)_/¯

* Horrible Hack Finished *




Itxaka




On 01/15/2016 05:13 AM, Adrian Turjak wrote:
I've run into a weird issue with the Liberty release of Horizon.

For our deployment we enforce emails as usernames, and thus for Horizon
we used to have "User Name" on the login page replaced with "Email".
This used to be a straightforward change in the html template file, and
with the introduction of themes we assumed it would be the same. When
one of our designers was migrating our custom CSS and html changes to
the new theme system they missed that change and I at first it was a
silly mistake.

Only on digging through the code myself I found that the "User Name" on
the login screen isn't in the html file at all, nor anywhere else
straightforward. The login page form is built on the fly with javascript
to facilitate different modes of authentication. While a bit annoying
that didn't seem too bad and I then assumed it might mean a javascript
change, only that the more I dug, the more I became confused.

Where exactly is the login form defined? And where exactly is the "User
Name" text for the login form set?

I've tried all manner of stuff to change it with no luck and I feel like
I must have missed something obvious.

Cheers,
-Adrian Turjak

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to