Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email validation needs an email parameter (docs) #577

Closed
dmaze opened this issue Apr 3, 2015 · 12 comments
Closed

Email validation needs an email parameter (docs) #577

dmaze opened this issue Apr 3, 2015 · 12 comments

Comments

@dmaze
Copy link

dmaze commented Apr 3, 2015

The documentation recommends creating a completion URL for email validation with

from flask import url_for
url = url_for('social.complete', backend=strategy.backend_name,
              _external=True) + '?verification_code=' + code

but you get a vague exception if the link isn't clicked within the same session. Adding an email query parameter fixes this. My working code looks like

from flask import url_for
url = url_for('social.complete', backend=strategy.backend_name,
              verification_code=code.code, email=code.email,
              _external=True)
@omab
Copy link
Owner

omab commented Apr 4, 2015

What's the vague exception?

@omab omab added the incomplete label Apr 4, 2015
@cmltaWt0
Copy link
Contributor

cmltaWt0 commented Apr 6, 2015

Exception Type: AuthMissingParameter
Exception Value: Missing needed parameter email

This exception is raised when we validate email within different session.
Step to reproduce:

  1. Send email to validate.
  2. Logout.
  3. Click validation link.

@omab
Copy link
Owner

omab commented Apr 27, 2015

If that's the error, it won't only fail the validation because email is "missing", it will also break the whole authentication process since the pipeline information is empty, the whole authentication process will fail.

@omab omab closed this as completed Apr 27, 2015
@cmltaWt0
Copy link
Contributor

cmltaWt0 commented May 8, 2015

@omab The whole authentication process is not fail - it will start as new login/register process...
And there is a problem because if user click to associate Email and confirm email from another PC (for example from Phone) it will fall into new login process but not into Email association process...

@craig-hacklaunch
Copy link

@omab as @maxsocl mention above I don't think the current implementation is how most users expect things to work. There should not be a dependency on the session for the mail validation partial. There is no guarantee the user will continue the process using the same device or even browser. Any state information should be retrievable from the validation link and not depend on the session.

@cmltaWt0
Copy link
Contributor

@omab @craig-hacklaunch
UPD: I got around this issue by creating custom Strategy, Storage and Code. In Code a have user_id field. And when user click confirmation link on different PC I can see exactly what user want to confirm an email.

@omab
Copy link
Owner

omab commented May 13, 2015

@maxsocl, @craig-hacklaunch, I see the problem now, and even if I think that this could be solved with a re-write of the email validation pipeline, this affects all the pipeline functions that use the partial mechanism, so, I'm already working on a restructure of the pipeline serialization functionality that will improve this behavior. Basically the pipeline data will be dumped to a DB table and a hash code will be used to identify the processes which can be stopped and continue later, removing the dependency of the session.

@craig-hacklaunch
Copy link

@omab thanks for your contribution to the community :). Your fix sounds like a good approach, I guess this will fix the problem for all partial pipelines that were using the session to dump their data to before.

@cmltaWt0
Copy link
Contributor

@omab it is a good news for everyone 😄 thank you for contribution!

@a1Gupta
Copy link

a1Gupta commented Oct 27, 2015

@omab Is it fixed now ? @maxsocl Can you please share the solution/fork you are using. I was using this https://gist.github.com/SaneMethod/b30156a3705ce9e944cd#file-django-python-social-auth-monkey-py till now , but it fails if session_key gets deleted/changed in the database. Django updates session_key each time the session data changes. So in case any other user logs in the same browser the session_key gets changed and user can't verify with the email link.

@annshress
Copy link

Any updates for MissingParameterEmail?

@annshress
Copy link

@dmaze your fix still gives me:

"error_messages": ["Password is None"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants