Comments (5)
So to avoid getting the Persona popup blocked by popup blocking while still fetching the URLs and arguments that /info/
provided, you have to either:
- Embed the data into the HTML (the path we chose).
- Fetch the data before the user clicks a login button via AJAX.
The second one is problematic because, depending on how long it takes to fetch the data, a user might click the login button and be blocked on the AJAX request finishing. I'm pretty sure (but not 100% sure) that waiting for that request will cause you to lose the "user-triggered action" bit and cause the popup to be blocked anyway, so I don't think adding the /info/
view back to django-browserid will help.
The goal is really just to tell our library's JS a few URLs and some arguments for the call to navigator.id.request
. Given that you control the backend URLs yourself (whereas django-browserid the library doesn't), it's probably fine to just have treeherder-ui manually add a <div id="browserid-info">
tag to its pages with the right URLs and arguments.
(And if you're worried about those URLs changing in a future version of django-browserid, don't be. Sometime within the next month or two I'm going to enable Django 1.8 testing, ensure that the library works on Django 1.8 with no warnings, and then roll a 1.0 release and call the API frozen.)
Would that be a decent solution?
from django-browserid.
I thought /info/ contained more than just URLs, since https://treeherder.mozilla.org/browserid/info/ returns:
..., "userEmail": "emorley@<snip>.com", ...
...when I am logged in, so it seemed like that was the only way to figure out the user's email (I'm really not familiar with browserid, or django-browserid in the slightest).
If that's not the case, then great :-)
from django-browserid.
@edmorley we can get some user info from https://treeherder.mozilla.org/api/user/ so manually adding the browserid bits in a tag seems to cover our case 😃 thanks @Osmose !
from django-browserid.
I thought /info/ contained more than just URLs
It used to, but doesn't anymore. We used to need the user's email to tell Persona what state the user was in for some weird auto-login behavior (like if a user was logged in to your site but not into Persona they'd auto-trigger a logout and some other weird crap), but Persona added a stateless mode that we use which is much simpler.
Nowadays it just has three URLs and some kwargs for navigator.id.request
. Check out https://github.com/mozilla/django-browserid/blob/master/django_browserid/helpers.py#L47 for details.
Glad this seems to work for you, feel free to reopen if you run into more issues. :D
from django-browserid.
It used to, but doesn't anymore. We used to need the user's email to tell Persona what state the user was in for some weird auto-login behavior (like if a user was logged in to your site but not into Persona they'd auto-trigger a logout and some other weird crap), but Persona added a stateless mode that we use which is much simpler.
Ah, that makes sense, thank you :-)
from django-browserid.
Related Issues (20)
- Document context processor removal in upgrade docs HOT 4
- csrftoken cookie not set by Django for most views HOT 4
- Impossible to override the redirect URL
- CsrfToken view should not be cached
- Use stateless Persona API HOT 1
- Updates to Goldilocks API HOT 2
- Docs for Custom User Model are a bit screwy HOT 2
- Disable autologin.js when BROWSERID_AUTOLOGIN_ENABLED = False even if it on the page. HOT 1
- Template tag browserid_logout breaks when link_class attribute is set HOT 2
- SSL certificate error HOT 3
- [Errno 32] Broken pipe on POST to /browserid/login/ and /browserid/csrf/ HOT 3
- The fancy_tag library isn't actually necessary HOT 4
- CSRF token fetching does not work with Django 1.8 HOT 4
- Document how to add a DTL template engine for 1.8 sites HOT 4
- Internet Explorer 11 specific error: "Relay frame could not be found " HOT 6
- Django 1.9 compatibility HOT 1
- Provide wheel package on PyPI HOT 11
- Django 1.8+ deprecation warning for urlpatterns in urls.py:28
- Verify.success_url never used with {% browserid_login %} HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-browserid.