Hello, friend, welcome back.
In a previous video, we successfully updated our Chanes profile.
And right now we can update our user name, email address, first name, last name, and then that is
another one as a password.
So for the password changes, they have the different like here right now in this video, I want to
discuss about the things we do.
How can change the password?
So if you want to change the password, then have the three different class.
If you go to Django, same official website and then the same pace.
And with this here they have some of the class I show you for changing that password, like there is
also the class as a said password form.
So right now, to use some of this type of bomb, the class form.
So it does if you use that same password form, it means a form that lets users change their password
without entering all password.
That means if you want to change that password, you don't need to put your password.
So if you want to do the paperwork, then you can use it without this class.
As I said, password class, OK?
And also they have another one.
They have another one as a password reset form.
And with this password, this form if you use it.
So this form is a form for generating and emailing a one time use liying to reset user password.
So if you want to be working like that way, then you have to use this class as a password reset from
class and also the other one as a password change form.
So if you use that password change from then this class actually from four, allow the user to change
their password.
OK, so that is actually the one of the class or whatever the class you will choose right now and to
do and to working with our this password change form.
So if you want to work this form, first of all, we have to do we have to input this class.
So that means, in our view, into The View page, first of all, right.
Now we don't need this.
I removed everything from here, OK?
So maybe Moubayed, so that is our view that missing out at blogging and The View so into the video,
first of all, here we have to do we have to import after that authenticate form here.
We have to import this so that your passport changed from.
Right.
So, first of all, you have to import it so you don't have to do we have to create all of the function?
And this will be just like that, SIM.
And if you already will understand about that concept and then it's not be tough for you because of
all here, I have to use everything as a default, all that functionalities.
So like no one to do and to create another function for the change password.
So here also, if you want to change that password, that means this user must have three login.
That means the locking is declared.
And then I take on the function name and I just name it as a password change or pass change.
OK, the name ID as a fast change.
And also here we have to pass that request.
And then I want to do first of all for changing the password.
This user already logged in.
Right.
So that means they have the current user we have to set.
So I just take one of the variable as a current user, current user, it should be just the same as
a requested user.
That means our distinguished user right here.
We have to set it and then we have to load our form and I load our form with our last name.
I have already loaded our class as a password change class.
So now with this class, we have to load our this form that is the default Django in the form for our
password change.
So now I take that things with this variable.
So here we have to do we have to pass it.
That means here I have already get our requested user.
That will be our current user.
I take the things with these variables here I simply perceived.
Right.
And then here we have to do we have to do the same thing.
So we have to add one def condition for our post.
That means that will be our form.
Right.
So which will be with our request and then method with the request method.
First of all, this will be check that is forced or not.
And then I want to do and to make our form, our form will be with our D password changes.
So that will be our final form, our password, password change form and password change from here.
We have to parse that.
Our current user.
Right.
That will be our current user and then current user, our request data.
So request and then our post site is simply added.
And also this request post.
That means when this user actually updated this password, this user already has some of the password.
Right.
So with this password, this user actually logged in for the here.
I wanted to take out this user current data post that.
I want to take it in particular.
What the variable I just name it as a data, OK?
I named it as a and data.
And here I take that our this current user post data, I take it with this data variable.
And after that I want to do I want to check it our form.
That means I want to check our validate.
So if our form is under is called valid, first of all it will be checked.
So if it's valid then I want to do want to save this form, our form.
I want to save it.
OK, current.
And after that I want to do and the load of the piece, that means in particular that area with the
return and the render and the return, then there is this parameter, one is the request and that is
the appropriate file location.
So in our app, logging into the app, logging here, here, I want to create one of the new file and
I just name it as a pass change fast and this could change, OK?
I just name it as a change dot as HTML.
So now we have to do we have to load it so better I just copy it.
So in our view here it be logging, that means app logging and then I'll pass order the symbol that
changed all this HTML and also after that I want to do and the password action data with the context.
So that is our data.
And additionally we have to do we have to pass out this form.
Right.
So now I want to learn to pass our key with the form and that will be our form.
So now we can actually load our this form in our PA system.
A lot in the past changed our estimate.
Right.
So now go to our past HTML and here it'll be just like our, um, that is our profile or whatever it
will be like.
I just take that logging better.
I just copy everything from a logging e-mail, you know, pasturelands here I posted.
So it will be also extended our basic HTML and lo.
Our crispy form, then it will be as a password change.
OK, so we have a password change space and I named it as a password change, which should be as a password
change.
And they have signed the form.
So from here, I have also powers that as a form.
So now we can actually use it with the form and the Crispi form and then it be as a of token and then
of the bottom button for the change.
OK, our password change whatever he wants right now, make that as a change.
So that will be our password change.
So that is our change form, right.
Perfect.
So now we have to do we have to create one that you are we have to create one of the wall for access
our this password change.
So that means in our app locking and that is all you are still here to do and to create a new one,
new one of the pod and then just name it as a password.
OK, just name it as a password, and in our view area, I have played a role and function or function
name as a past change.
So now I name it as a pass change and also a name that our part as a pasturelands.
OK, so now let's check this out.
Now, if you click as the save and now if you go to our site and here I'll refresh it.
And now if you go to our this farm, that means this one, you can see this suffering of the account
and the passport click here is perfectly redacted to our account password base.
So there is our old password page.
That is our new password and the new password confirmation that is our form is now successfully loaded.
Right.
So from here, we successfully loaded our interview area with our password transform into the password
changed from everything that means our DVD or by default estimate, you can see the old password, a
new password and our new confirmed password.
And also here, if you want to do this type of work or NDR password will be updated, then to be sure
some of the notification, then you can also do that work for doing this.
We have to do we have to work.
In our view, that means into the view and that is our password changes that we saw our function as
a password change and in our current.
And after that, first of all, I want to make I take one of the variable as a change, like a change
and make that as a false so simple.
Be just like that.
Same before we have already added this type of work.
And after that saved data, I wanted to make that as a true right.
So here I wanted to make that as it should be, as a true.
So when this data will be saved successfully, then it'll be a true and what it should be as a true.
I don't want to make our password these changes that are in our context.
That means here after that.
After that I the do in the past that the change, I just simply pass that key.
So right now we can actually use that our d change in our this space that upon our password change space
to go to our passport in space here.
So after this, I want to do I want to add on to the that means here.
That is actually our blog.
That means in our body block area we have to edit.
Right.
So in particular, that really I want to do under this condition one of the if condition, if our from
here, I name it as a changed.
So if this is a change, that means if this password is successfully updated, then it should be the
one of the work I take on the Dave and I take on the alert, OK, alert plus alert alerts, success
alert our success and here should be displayed on the text as a password since successfully so this
type of one of the takes is still visible.
And also we have to do we have to end this hour if condition.
I just added as a and if perfect I hope friend you will understand about it because we did the same
ten things before.
So from here, first of all, I want to make that as an hour more.
Take one of the variable and I just take that out.
This current user, all the data, the false and later in this hour form is updated.
I make that as a true and then I simply pass it in our contact space.
That means in our dictionary.
So now we can actually use it in our password, change space to enter the password.
Genspace, I first of all, I put that condition.
If it's charged, then it should be displayed this one.
Right then I just put away.
And if so, that means or else it should be displayed this portion.
Right.
So when it's updated then are still visible.
Now, let's check this out.
If you click, as I say.
Well, first of all, I want to check it service perfectly running now.
Refresh it again.
So right now, I'm already using one of the password as you do me.
One, two, three, four, five.
Right.
So now if you want to change it, like here we have to do we have to put your appropriate password.
So here, if you put that in appropriate password and like here automatically you'll get that validation
like this is not showing as your old password was entered is incorrect.
Right?
So here you don't need to add any validation.
All the validation is really made in our this function area that this class area that is our password
transformatory.
So here we don't need to change anything.
So no one did want to put our appropriate old password right now.
That is our current password.
So that is it.
You do me one, two, three, four, five now and change it as you do me.
One, two, three, four, five, six.
As it you do me one, two, three, four, five, six.
OK, so now the change is clear.
The change.
Yes.
You can see for now successfully updated and also switching as a password change successfully.
So now if you click on the log out.
So that is all logging.
So right now I'm logging with the test and a password you do me one, two, three, four, five.
So now if you click as fighting is a logging now, this it's not showing is incorrect.
So now I have updated or password.
You give me one, two, three, four, five, six.
Now click is a logging.
Yeah, you can see now we can actually successfully locked in a coffin and also from here you can log
out perfect, I hope is very much clear to you.
So right now you can actually update your profile.
You can update your password.
Right.
So there is six click as a logging.
So that is our profile.
And you can if you want to change that profile, details that in the profile info, you can change that
profile info.
If you want to change that password, that you can also change that password.
Right.
So now we can successfully do that work.
I hope you enjoy it.
Very much so, friend.
I want to continue this process.
You know, next video.
I want to add one of the emails option for the profile that this user should have asked how the default
picture and then when this user want to update that picture, how can update it?
So step by step, I will show that things with a live example.
So thanks for watching.
I will see you in the next video.