-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Fix AttributeError in checkout #999
Conversation
It would be nice to know why we no longer try to auth the user. |
User is authenticated in form's save method - only when we pass request as an argument. We don't need to do it twice. |
Ok, another question then: why do we have a form that accepts |
It was logic partially taken from previous version of |
Ideally, yes, I'd like to avoid passing |
Codecov Report
@@ Coverage Diff @@
## master #999 +/- ##
=========================================
+ Coverage 63.02% 63.3% +0.27%
=========================================
Files 116 116
Lines 6088 6088
Branches 743 743
=========================================
+ Hits 3837 3854 +17
+ Misses 2102 2079 -23
- Partials 149 155 +6
Continue to review full report at Codecov.
|
saleor/order/views.py
Outdated
register_form.save() | ||
password = form_data.get('password') | ||
user = auth.authenticate(email=email, password=password) | ||
if user: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Under what circumstances can we not get an authenticated user here? Shouldn't that result in a form error? How do we attach the order if the user is None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right - user won't be authenticated only when there is an issue with form. I'll remove if user:
in a minute.
saleor/order/views.py
Outdated
auth.login(request, auth_user) | ||
attach_order_to_user(order, auth_user) | ||
register_form.save() | ||
password = form_data.get('password') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we take the password from register_form.cleaned_data
?
Fix #998