1
00:00:00,520 --> 00:00:08,950
We are going to implement password update and going to be the same as we did for the user details,

2
00:00:08,950 --> 00:00:16,720
update for the password going to be easier as compared to the user details simply because when I click

3
00:00:16,720 --> 00:00:24,970
on a link to display the form for me to update, we are not going to pre populate the existing password,

4
00:00:24,970 --> 00:00:27,490
but for user details we did that.

5
00:00:27,520 --> 00:00:33,130
The next one is that for password we are going to update one field.

6
00:00:33,130 --> 00:00:34,660
So let's have a look.

7
00:00:34,660 --> 00:00:37,780
Before we get into that, let's look at the controller.

8
00:00:37,780 --> 00:00:44,770
So inside the controllers uses and let's locate the update password.

9
00:00:44,770 --> 00:00:52,360
And this is the implementation and you can see that we are accepting only the password field.

10
00:00:52,360 --> 00:00:54,070
So let's continue.

11
00:00:54,490 --> 00:01:01,870
And for this, I don't want to find the user using the ID in the param, but instead I'm going to find

12
00:01:01,870 --> 00:01:04,239
the user inside this session.

13
00:01:04,239 --> 00:01:08,800
So I'm going to be as Rick dot session dot user auth.

14
00:01:12,710 --> 00:01:13,510
Perfect.

15
00:01:13,520 --> 00:01:20,570
So with this one, we need to make some changes to the route because now we have changed the params

16
00:01:20,570 --> 00:01:26,840
to use the log in user ID and this is a route for update password.

17
00:01:26,840 --> 00:01:28,550
So I'm going to remove this one.

18
00:01:29,210 --> 00:01:34,580
The next step is that we need to have a button or an icon to click on.

19
00:01:34,580 --> 00:01:37,130
So let's get to the profile.

20
00:01:37,220 --> 00:01:38,720
That is a template.

21
00:01:41,760 --> 00:01:44,490
And where we have these icons.

22
00:01:44,490 --> 00:01:47,280
I want to add one icon here.

23
00:01:47,310 --> 00:01:48,650
These are the icons.

24
00:01:48,660 --> 00:01:57,510
So I'm going to add one here so I can copy one of these icons and then paste it here.

25
00:01:58,230 --> 00:02:03,480
The icon for this is not this one, but instead f a solid.

26
00:02:04,360 --> 00:02:06,610
And if it does key.

27
00:02:06,940 --> 00:02:08,710
So let's have a look.

28
00:02:10,759 --> 00:02:13,370
And you can see we have it as that.

29
00:02:13,370 --> 00:02:15,750
But I want to have the same side.

30
00:02:15,770 --> 00:02:19,400
So I'm going to add a class called F as.

31
00:02:20,450 --> 00:02:22,250
And let's have a look.

32
00:02:23,470 --> 00:02:25,180
And I have it as that.

33
00:02:25,180 --> 00:02:28,890
Next one is I want to change the color to yellow.

34
00:02:29,130 --> 00:02:33,100
I want to have inline styling that is color to yellow.

35
00:02:37,390 --> 00:02:45,220
Next step is that when I click on this icon, I want to render the update password form and we are going

36
00:02:45,220 --> 00:02:46,780
to use the log in.

37
00:02:46,780 --> 00:02:52,540
So I'm going to duplicate this one and change the name to update.

38
00:02:53,900 --> 00:02:54,770
Password.

39
00:02:56,930 --> 00:03:00,500
And for this one, I'm going to remove the email.

40
00:03:02,280 --> 00:03:04,680
And maintain the password only.

41
00:03:04,680 --> 00:03:07,830
And this one is going to be as update.

42
00:03:08,560 --> 00:03:11,590
And I'm going to remove this one from here.

43
00:03:12,510 --> 00:03:20,370
And then for the form that is a you are or endpoint going to be API, use it forward slash update password.

44
00:03:20,370 --> 00:03:27,420
So let me cross-check again inside the users root and it's called update password.

45
00:03:31,900 --> 00:03:35,200
And question mark on that score method.

46
00:03:35,680 --> 00:03:41,320
And I'm going to use put method, and I have the name here as that.

47
00:03:41,500 --> 00:03:47,140
So let's go ahead and create one route to render the password form.

48
00:03:47,350 --> 00:03:51,880
I can copy one of this one or I can use this one.

49
00:03:51,880 --> 00:03:53,710
So let me bring back this one.

50
00:03:53,710 --> 00:03:57,670
And for this one I'm going to be updating user password.

51
00:04:01,770 --> 00:04:05,730
And then I went to render the update password.

52
00:04:11,310 --> 00:04:12,270
All right.

53
00:04:12,390 --> 00:04:14,640
So in next is let's use this.

54
00:04:14,640 --> 00:04:18,120
You are an endpoint inside the profile.

55
00:04:18,120 --> 00:04:20,519
So let's go to profile.

56
00:04:20,880 --> 00:04:26,190
And for this one, I'm going to change this one to this.

57
00:04:26,990 --> 00:04:27,620
All right.

58
00:04:27,620 --> 00:04:33,980
So now when I click on the icon, I'm expecting to open the update password form.

59
00:04:33,980 --> 00:04:35,150
So let's have a look.

60
00:04:36,830 --> 00:04:43,110
Well, we have an error simply because we need to pass in the error properly into this.

61
00:04:43,110 --> 00:04:49,130
So we're going to be as error and by default is empty.

62
00:04:49,550 --> 00:04:57,320
So let's try again, refresh and click on that and we have the update password.

63
00:04:57,320 --> 00:05:02,840
So let me change the title from log in to update password.

64
00:05:07,490 --> 00:05:08,390
All right.

65
00:05:08,600 --> 00:05:13,280
So now it's time for us to taste the actual request.

66
00:05:13,280 --> 00:05:17,760
But before we get into that, let's try to display an error.

67
00:05:17,780 --> 00:05:22,070
In case you're going to have one, let's go to use this controller.

68
00:05:22,070 --> 00:05:24,320
And here we go.

69
00:05:24,350 --> 00:05:32,510
So here, instead of ten in this JSON data, we are going to redirect and we can copy this code.

70
00:05:36,960 --> 00:05:42,210
And in case we have an error, we are going to display the error.

71
00:05:42,210 --> 00:05:45,060
So I'm going to copy this one also.

72
00:05:45,630 --> 00:05:48,700
And down here, I'm going to pass it here.

73
00:05:48,720 --> 00:05:55,230
And for the error, I want to get it from the error dot message.

74
00:05:55,440 --> 00:05:57,450
Now, we'd be good to go.

75
00:05:57,450 --> 00:05:57,840
So.

76
00:05:57,870 --> 00:05:59,310
Moment of truth.

77
00:05:59,340 --> 00:06:01,050
Let me go to profile.

78
00:06:02,160 --> 00:06:09,360
And click on this icon and let me change to one, two, three, four, five, six update.

79
00:06:09,930 --> 00:06:12,090
And it worked fine.

80
00:06:12,090 --> 00:06:14,670
So let me look out now.

81
00:06:14,670 --> 00:06:18,930
Let me log in back with the updated password for this one.

82
00:06:18,930 --> 00:06:27,360
I use this user code email at gmail.com, and then the previous password was one, two, three, four,

83
00:06:27,360 --> 00:06:27,780
five.

84
00:06:27,780 --> 00:06:29,130
So let's have a look.

85
00:06:29,130 --> 00:06:36,030
But if I use the updated password and that is one, two, three, four, five, six, let's have a look.

86
00:06:37,810 --> 00:06:38,470
All right.

87
00:06:38,470 --> 00:06:39,780
So it worked.

88
00:06:39,790 --> 00:06:44,710
The next video, let's go ahead and then populate the user post.

