justinarat / Teamify

0 stars 0 forks source link

I46 setup login page with flask form #49

Closed justinarat closed 4 months ago

justinarat commented 5 months ago

Changes:

justinarat commented 4 months ago

Just realised, maybe signup_request() and login_request() should go in a different file like login-routes.py cause it doesn't render a page like the others in routes.py.

dominictdavies commented 4 months ago

Just realised, maybe signup_request() and login_request() should go in a different file like login-routes.py cause it doesn't render a page like the others in routes.py.

Ah yeah that sounds like a good idea to me. We don't want every route going thru the one file, so would be good to separate into other files where possible.

FAljanobi commented 4 months ago

are we waiting to merge until the sql bit is written so people can make accounts?

justinarat commented 4 months ago

are we waiting to merge until the sql bit is written so people can make accounts?

I was thinking about that, but because of how I titled this issue I thought I'd just setup the login form with FlaskForm here, then work on handling the login (including sql) when I work on setting up FlaskLogin (issue 42).

FAljanobi commented 4 months ago

give me a moment then, i have some local commits on this branch that i wanna save, cause i was trying to figure out how to use sql alchemy to check if the inputted login info is in the db

FAljanobi commented 4 months ago

i pushed a commit that has login "work" [it checks the db successfully and prints to the server if there is a match or not]. should i try and make signup "work" as well?

justinarat commented 4 months ago

i pushed a commit that has login "work" [it checks the db successfully and prints to the server if there is a match or not]. should i try and make signup "work" as well?

Yeah I think that's good. Just one thing, should use flask forms to extract the data (username, password) instead of requests so it's consistent. Just need to change request.form[] to login_form.username.data or something like that.

justinarat commented 4 months ago

Decided to just setup FlaskLogin here cause other features need it and should be done asap I think.

FAljanobi commented 4 months ago

i think next step is cookies so people stay logged in EDIT: whoops utils py is part of .env

justinarat commented 4 months ago

i think next step is cookies so people stay logged in, and im trying to read utils.py and i dont know if its actually active or not?

I'm pretty sure flask login handles the cookies for us and is what login_user() method does, so should be good

FAljanobi commented 4 months ago

so does that mean issue #49 is complete?

justinarat commented 4 months ago

so does that mean issue #49 is complete?

Yeah just need to move the login and signup routes to another file like login-routes.py, then we should be done

justinarat commented 4 months ago

@FAljanobi Are the print statements just for debugging? is it ok to remove them?

Otherwise I think login and signup is done

justinarat commented 4 months ago

I think there's not much more to do here now apart from tests maybe, but can do that in a separate issue.

You can go to branch i39 to test logins cause the header changes with logins there.

JohnGiampaolo commented 4 months ago

Question: whenever the login or signup forms are submittied, they return the validateSignup(id) javascript function. This was written in early stages to check whether all fields in the forms were complete, however now that we are using flaks forms, and in the form classes where we have "validators=[DataRequired()]" does this imply that the javascript function is no longer necessary?

justinarat commented 4 months ago

In the rubric under javascript it says we need client side validators, so probs need more of it lol