mozilla / django-browserid

Django application for adding BrowserID support.
Mozilla Public License 2.0
180 stars 80 forks source link

Template tag browserid_logout breaks when link_class attribute is set #268

Closed seocam closed 9 years ago

seocam commented 9 years ago

The browserid_logout tag breaks if I try to use the link_class attribute as follow:

{% browserid_logout text='Logout' link_class='aaa bbb ccc' %}

Apparently it generates the right link but when I link on it I get the following message:

{"error": "Method not allowed."}

It seems to me the JS is not been able to handle the link when the classes are set.

seocam commented 9 years ago

This almost vanilla django project reproduces the bug: https://github.com/TracyWebTech/logoutbroken

seocam commented 9 years ago
<a href="/browserid/logout/" data-next="/" class="aaa bbb ccc" >
...
<a href="/browserid/logout/" data-next="/" class="browserid-logout" >

The template tag is overriding the default class which the JS relies on. Using an ID instead of the class would fix it but limit the login button to just one.

Making the template tag append the class instead of replacing it seems a better approach to me.