Re: [openstack-dev] [Horizon] Email as User Name on the Horizon login page

2016-01-17 Thread Adrian Turjak
Updating the label code in django_openstack_auth isn't an option since
it would mean forking and maintaining our own copy of the library for
most likely one line of code.

Diana, any clue how would I go about overriding the label solely with
code placed in Horizon? Ideally we'd like to just place this in our own
theme to make rebasing horizon changes easier, but if needed we can live
with making this a non-theme patch for us to carry.

No clue how much we care about Localization, but if the answer is that
we do, how much work do you think adding "Email" to our Horizon
Localization would be?

Cheers,
-Adrian

On 16/01/16 07:43, Diana Whitten wrote:
> Adrian,
> 
> Changing the label is also possible through overrides, but customizing any
> label that goes through Localization might affect other languages.  Not
> sure if this might be a problem for you.
> 
> If this isn't ideal, we can easily put in hooks to allow customization
> purely through CSS, using pseudo selectors like ':before' or ':after' in
> combination with 'content'.  We just need to wrap the contents of the label
> with an inner span.
> 
> Thoughts?
> 
> - Diana
> 
> 
> 
> On Fri, Jan 15, 2016 at 10:47 AM, Lin Hua Cheng  wrote:
> 
>> It might be simpler to just update the label on the python code. This is
>> where the form label are defined.
>>
>> You can update the label here:
>> https://github.com/openstack/django_openstack_auth/blob/stable/kilo/openstack_auth/forms.py#L51
>>
>> -Lin
>>
>>
>> On Fri, Jan 15, 2016 at 12:54 AM, Itxaka Serrano Garcia >> wrote:
>>
>>>
>>> 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:
>>> {{ field.label }}
>>>
>>> For this:
>>> {% if field.label == "User Name" and not
>>> request.user.is_authenticated %}Email{% else %}{{ field.label }}{% endif
>>> %}
>>>
>>>
>>> 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
>>>
>>
>>
>> __
>> OpenStack Development Mailing List (not for usage questions)
>> Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe

Re: [openstack-dev] [Horizon] Email as User Name on the Horizon login page

2016-01-15 Thread Adrian Turjak

Thanks, as a hack that's not a bad fix.

We maintain our own Horizon repo anyway and rebase often, so it's a 
change we can carry if needed.


I'm just confused as to why these changes were made to work as they are. 
I mean sure having the html populate based on the form details is nice 
in theory, but having that in a place you can't access or customize 
because it's in a secondary library feels like over engineering.


What is the point of themes if we can't change something as basic as a 
form field label?


On 15/01/2016 9:54 p.m., Itxaka Serrano Garcia wrote:


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:
for="{{ field.auto_id }}">{{ field.label }}


For this:
for="{{ field.auto_id }}">{% if field.label == "User Name" and not 
request.user.is_authenticated %}Email{% else %}{{ field.label }}{% 
endif %}



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



__
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


Re: [openstack-dev] [Horizon] Email as User Name on the Horizon login page

2016-01-15 Thread Lin Hua Cheng
It might be simpler to just update the label on the python code. This is
where the form label are defined.

You can update the label here:
https://github.com/openstack/django_openstack_auth/blob/stable/kilo/openstack_auth/forms.py#L51

-Lin

On Fri, Jan 15, 2016 at 12:54 AM, Itxaka Serrano Garcia 
wrote:

>
> 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:
> {{
> field.label }}
>
> For this:
> {% if
> field.label == "User Name" and not request.user.is_authenticated %}Email{%
> else %}{{ field.label }}{% endif %}
>
>
> 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
>
__
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


Re: [openstack-dev] [Horizon] Email as User Name on the Horizon login page

2016-01-15 Thread Diana Whitten
Adrian,

Changing the label is also possible through overrides, but customizing any
label that goes through Localization might affect other languages.  Not
sure if this might be a problem for you.

If this isn't ideal, we can easily put in hooks to allow customization
purely through CSS, using pseudo selectors like ':before' or ':after' in
combination with 'content'.  We just need to wrap the contents of the label
with an inner span.

Thoughts?

- Diana



On Fri, Jan 15, 2016 at 10:47 AM, Lin Hua Cheng  wrote:

> It might be simpler to just update the label on the python code. This is
> where the form label are defined.
>
> You can update the label here:
> https://github.com/openstack/django_openstack_auth/blob/stable/kilo/openstack_auth/forms.py#L51
>
> -Lin
>
>
> On Fri, Jan 15, 2016 at 12:54 AM, Itxaka Serrano Garcia  > wrote:
>
>>
>> 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:
>> {{ field.label }}
>>
>> For this:
>> {% if field.label == "User Name" and not
>> request.user.is_authenticated %}Email{% else %}{{ field.label }}{% endif
>> %}
>>
>>
>> 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
>>
>
>
> __
> 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


Re: [openstack-dev] [Horizon] Email as User Name on the Horizon login page

2016-01-15 Thread Itxaka Serrano Garcia


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:
{{ field.label }}


For this:
{% if field.label == "User Name" and not 
request.user.is_authenticated %}Email{% else %}{{ field.label }}{% endif 
%}



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


[openstack-dev] [Horizon] Email as User Name on the Horizon login page

2016-01-14 Thread Adrian Turjak
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