1
00:00:05,300 --> 00:00:06,290
Welcome back.

2
00:00:06,350 --> 00:00:12,580
Let's finish off this section of a simple project exercise for this project you'll create a very simple

3
00:00:12,580 --> 00:00:14,770
username requirements check Web site.

4
00:00:15,040 --> 00:00:20,890
Basically a user is going to type out a user name into a form hit submit and then the flask application

5
00:00:20,980 --> 00:00:26,160
is going to grab that user name in the backend and it's good check to see if the user name passes through

6
00:00:26,160 --> 00:00:27,310
your requirements.

7
00:00:27,310 --> 00:00:32,360
So just like in our earlier example where we grab the first name and last name of the people that wanted

8
00:00:32,380 --> 00:00:34,190
to audition for that puppy rock band.

9
00:00:34,420 --> 00:00:39,110
We didn't actually do any checks on them so we just sent them to another thank you page where you're

10
00:00:39,130 --> 00:00:44,650
going to do now is grab the username do a little bit of check on it and then provide some more information

11
00:00:44,650 --> 00:00:45,930
to the report page.

12
00:00:46,910 --> 00:00:51,830
So the requirements here for the username that the user actually enters into the form is that the user

13
00:00:51,830 --> 00:00:53,770
name must contain a lowercase letter.

14
00:00:53,960 --> 00:00:58,020
It must contain an uppercase letter and it must end in a number.

15
00:00:58,040 --> 00:01:02,290
There are essentially a infinite number of ways you could check this with Python.

16
00:01:02,300 --> 00:01:06,710
So it's really up to you how you check these requirements inside your py file.

17
00:01:06,830 --> 00:01:11,210
But these are the pharmacy are going to have to check for with the user name is provided in that form.

18
00:01:11,210 --> 00:01:15,500
So if you grab that username in the form you're going to have some Python code logic that checks to

19
00:01:15,500 --> 00:01:20,630
see if these conditions are met and then you can have three template to files.

20
00:01:20,800 --> 00:01:25,320
One is a base HTL file that has a nav bar of Home link.

21
00:01:25,330 --> 00:01:30,250
The second is your index page which is essentially just going to have the simple form that redirects

22
00:01:30,250 --> 00:01:35,230
to a report page upon hitting submit that username and then the report page is going to indicate whether

23
00:01:35,230 --> 00:01:37,720
or not the username passed requirements.

24
00:01:37,720 --> 00:01:40,810
So let's go ahead and see what this page would look like in action.

25
00:01:40,810 --> 00:01:43,610
All right so this is what the web application should look like.

26
00:01:43,630 --> 00:01:45,000
Notice here I have a nav bar.

27
00:01:45,010 --> 00:01:49,690
That's coming from that base h him Al file and I have a little bit of information here welcome to the

28
00:01:49,690 --> 00:01:51,040
puppy user name check.

29
00:01:51,040 --> 00:01:55,600
Let's see if your username is secure and I ask you to fill out the form below a fuse name that has these

30
00:01:55,600 --> 00:01:58,240
three restraints has to have an uppercase letter somewhere.

31
00:01:58,270 --> 00:02:01,630
A lower case letters somewhere and then it must have a number at the end.

32
00:02:01,630 --> 00:02:06,510
So here you have a very simple form which is labeled username and LOYN to enter a user name.

33
00:02:06,520 --> 00:02:08,690
Let's provide one that we know is going to pass.

34
00:02:08,710 --> 00:02:15,310
So I'll start with capital E will say Eddie one then we get to the report page where it says Let's see

35
00:02:15,310 --> 00:02:16,330
how you perform.

36
00:02:16,450 --> 00:02:21,280
And it looks like the user name did pass the three requirements which makes sense because we had a capital

37
00:02:21,280 --> 00:02:24,170
letter and then a number at the end of some lower case letters as well.

38
00:02:24,430 --> 00:02:25,660
Let's go back to home page.

39
00:02:25,690 --> 00:02:28,320
And now let's do one that we know is not going to pass.

40
00:02:28,630 --> 00:02:33,850
So if I just say rufous and all lowercase are going to hit submit and it says oh looks like you have

41
00:02:33,850 --> 00:02:39,700
some issues of your username so I didn't have an uppercase character and I did not enter a username

42
00:02:39,750 --> 00:02:40,890
with a number.

43
00:02:40,930 --> 00:02:46,150
So inside of your template you're going to have some bits of logic to report back whether or not you

44
00:02:46,150 --> 00:02:47,030
had a success.

45
00:02:47,080 --> 00:02:51,250
And you also want to report back what failures there were so notice here.

46
00:02:51,280 --> 00:02:57,070
It might make sense to pass in a bunch of conditioned checks and then use that template control flow

47
00:02:57,370 --> 00:03:00,550
in order to print out what worked and what didn't work.

48
00:03:00,550 --> 00:03:05,560
As far as the requirements go we're essentially combining everything we just talked about here in your

49
00:03:05,620 --> 00:03:09,940
templates lectures to actually finish off this project.

50
00:03:09,940 --> 00:03:14,860
Now as far as approaching this project if you're feeling a little more ambitious go ahead and just go

51
00:03:14,860 --> 00:03:15,500
for it.

52
00:03:15,700 --> 00:03:18,030
Try it if you can do it on your own completely.

53
00:03:18,280 --> 00:03:22,960
If you want a little bit of guidance we have some skeleton code available for you inside of our templates

54
00:03:22,960 --> 00:03:23,610
folder.

55
00:03:23,770 --> 00:03:28,920
And if you are feeling a little uneasy with combining all these steps that's absolutely no problem but

56
00:03:28,930 --> 00:03:33,940
you can do is head on over to the next lecture and treat it as a code along solution lecture.

57
00:03:33,970 --> 00:03:37,900
Really it's up to you whatever approach you feel more comfortable with and another approach you can

58
00:03:37,900 --> 00:03:41,700
do is watch the solutions lecture and then see if you can do it all on your own.

59
00:03:41,740 --> 00:03:46,050
That's another great approach for people who are learning and just starting out a flask.

60
00:03:46,060 --> 00:03:46,700
All right.

61
00:03:46,780 --> 00:03:48,790
Best of luck on this project exercise.

62
00:03:48,790 --> 00:03:51,930
We'll see you in the next lecture where we start going over the solutions.
