mikeizbicki / cmc-csci040

Computing for the Web
37 stars 58 forks source link

Create__user question #228

Closed milesba4 closed 2 years ago

milesba4 commented 2 years ago

Hello Professor,

I have two questions:

  1. I'm trying to add a created username to the SQL database if the username doesn't exist and am wondering if I am doing it correctly. is there a way to check if the username is added to the database? Am I on the right track?

    Screen Shot 2021-12-15 at 1 08 13 AM
  2. every time I type something into the forms on the create user webpage it takes me back to the login webpage, but I'm not sure why this problem is occurring. My render template is connected to my create_user HTML file.

milesba4 commented 2 years ago

This is my is_valid_user function

Screen Shot 2021-12-15 at 9 17 09 AM
mikeizbicki commented 2 years ago

is there a way to check if the username is added to the database?

There are multiple ways: First, you can manually inspect the database contents (e.g. using the sqlite3 command or the db_access.py file). Second, you try logging in with the user that you just created. The second method is how I will be testing your code.

every time I type something into the forms on the create user webpage it takes me back to the login webpage

You should review the html form's action attribute here: https://www.w3schools.com/tags/att_form_action.asp and make sure it is set correctly.

milesba4 commented 2 years ago

Thank you, is there a source I can look at for creating a form for the confirm password table? so far I have 3 forms, one of them being the confirm password but it doesn't work

Screen Shot 2021-12-15 at 1 22 39 PM Screen Shot 2021-12-15 at 1 22 52 PM
milesba4 commented 2 years ago

Hi @Tonnpo,

The confirm password form is put in place so that the user doesn't accidentally create an unintended password in the scenario that they make a typo when creating it. Im trying to make it so that the user must type in the same word in the confirm password form that they typed in the create password form in order to successfully create an account. Once they do that same create_username and create_password is added to the SQL database so that they can login

milesba4 commented 2 years ago

To specify, my issue is that when the user types something into the confirm_password form, it is returning that they typed nothing in the confirm_password form instead of returning the word that they input.

mikeizbicki commented 2 years ago

There's no code provided that has a password confirmation field in the form. You need to get that part working on your own.

The HTML/python code that you've included above looks fine to me. So whatever the problem is, I don't think it's in those lines of code. Sorry I can't be of more help.