Add section where the user can change their password
This can be copy/pasted from IntelOwl
@mlodic Please assign it to me .
Done! :) @ChaitanyaChute , please take a look at the IntelOwl repo and try to adapt the functionality to our project.
Are you still working on this @ChaitanyaChute ?
@regulartim I’m currently occupied with exams, so I’m not working on this right now.
Ok, give it a try!
Are you still working on this @ChaitanyaChute ?
Hi @mlodic
I’d like to work on this issue.
This looks simple—I can implement it within a day.
@sristyanand00 you are welcome to the project but please read guidelines before starting contributing. You can be assigned to only one task at a time. Please start with this one
What's the status here @sristyanand00 ?
@regulartim Thanks for checking in.
This will be done today. I’ll update the issue once it’s completed.
@sristyanand00 Sorry, but I will unassign you due to inactivity.
Hi, I've gone through the discussion and the previous PR by @sristyanand00 . Can I get assigned to this?
Yes, sure! :)
I'm not much familiar with django. Any pointers to get started would be appreciated. For the back what i understood so far is I have to create a serializer and a view for ChangePassword and finally add a route. Is that correct?
As already mentioned, this can basically be copy/pasted from Intelowl. Maybe take a look how it is solved there. Also take a look at the Django docs. I guess this is a very common functionality, it should be somewhat described there.
While going through the IntelOwl code i found this
old_password = request.data.get("old_password")
new_password = request.data.get("new_password")
# Check if the old password matches the user's current password
user = request.user
uname = user.username
if not check_password(old_password, user.password):
...
# Set the new password for the user
user.set_password(new_password)
new_password is set without any checks (even if its empty string) while a regex REGEX_PASSWORD = r"^(?=.*[a-zA-Z])\S{12,}$" already exists in the codebase to check the validity of a password.
It looked like a good addition so I have added the regex match for now. Let me know if this change from the original implementation is okay.