-
Notifications
You must be signed in to change notification settings - Fork 31
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
[WIP]Users-Back-End #234
base: master
Are you sure you want to change the base?
[WIP]Users-Back-End #234
Conversation
API/chat/models.py
Outdated
(OTHER, 'Other') | ||
) | ||
|
||
user = models.OneToOneField(User, on_delete=models.CASCADE) |
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.
nit
API/chat/forms.py
Outdated
|
||
class SessionForm(AuthenticationForm): | ||
username = forms.CharField(max_length=20) | ||
password = forms.CharField(max_length=32, widget=forms.PasswordInput) |
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.
strip=False
API/chat/forms.py
Outdated
code='wrong_password' | ||
) | ||
|
||
return "Authenticate" |
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.
Check is_active
before authenticating
if password is not None: | ||
raise forms.ValidationError( | ||
'password_set', | ||
code='password_set' |
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.
Fill in at ARCHITECTURE.md
API/chat/forms.py
Outdated
timestamp = timestamp_to_datetime(now) | ||
|
||
user.tinguser.last_used = timestamp | ||
user.tinguser.location = "oti na nai" |
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.
Allow NULL
|
||
dbmessage = users[0] | ||
self.assertEqual(dbmessage.username, user.username) | ||
self.assertEqual(dbmessage.password, user.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.
Why is this check needed?
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.
Just to check if both passwords are equal to None.
Do you want to remove it completely ?
API/chat/views.py
Outdated
if error.code in [ | ||
'password_required', 'wrong_password', 'username_reserved' | ||
]: | ||
return HttpResponseForbidden() |
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.
Return the actual string code, for interoperability with other clients.
API/chat/views.py
Outdated
return HttpResponseForbidden() | ||
|
||
if error.code == 'password_set': | ||
return HttpResponseNotFound() |
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.
likewise
API/chat/views.py
Outdated
return HttpResponseNotFound() | ||
|
||
if error.code == 'invalid_username': | ||
return HttpResponseBadRequest() |
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.
likewise
API/chat/views.py
Outdated
return HttpResponseBadRequest() | ||
|
||
elif resp == "Unreserved": | ||
tinguser_form.save() |
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.
where is this defined?
28a0825
to
c914142
Compare
c914142
to
57d3c7a
Compare
No description provided.