[ DAY 135 ] Step by step

Planning. It is all built upon good plans and an understanding perspective of the project. Today, while working on my sign-up and log-in pages, with all their functions, I had to stop and come back to planning. To talking to myself about what needed being done. To writing down pseudo code and more pseudo code. To keep in mind that my code doesn’t come out of nowhere – it’s from me and what I do to build upon my own knowledge and my googling skills.

The past few days were only about authentication – username and password explicitly. I aforementioned I wanted to write documentation for this simple project, and so I’ll start its draft here.

Rules for a valid username:
• Username doesn’t exist in database
• Input field is not empty
• It doesn’t contain capitalized letters and special characters, except for dots (.) and dashes (-)
• It is longer than 6 characters and shorter than 100 characters
• It has to have lowercase letters

Here’s a snippet of my code for client-side username validation:

Rules for a valid password:
• Input field is not empty
• It has at least 6 characters and at most 100 characters
• It has at least one special character
• It has at least one uppercase letter
• It has at least one lowercase letter
• It has at least one number

Here’s a snippet of my code for client-side password validation:

To check requirements for uppercase/lowercase letters, number, or special characters, I used regex. Please let me know if there are better solutions.

And then, putting them all together, I make sure username and password is valid before sending to server with the below code:

— as of 10PM

I have worked on the backend and was happy with the progress I made, yet I still haven’t decided how I want to check if username has been in the database and prevent accounts of the same username. I have gained confidence in organizing my code (I used to feel as though I needed to follow a certain standard), and I am working hard on saying, “OK let’s break this down and work from the bottom up.” “What do I need and want to do?” As long as I can answer these questions, everything feels a little bit less intimidating.

Published by Thi Le


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: