In order to use the website users need to be logged in. If they try to access any page and are not logged in, they should be directed to signup or login. Signup Ask the user for their Email, UserName and Password. If their Email is already in use, show an error. The email should have an @ and a. the UserName and Password can not be blank If everything is OK, save their information to a database and automatically log them in. Login Ask for their Email (or UserName) and Password. If something is wrong, show an error. If everything is OK log them into the system and redirect them to the Profile page. Profile Pick a URL to show someone's profile. This could be /profile/username or /@username or /u/username (whatever you'd like). Show the user's photo, UserName and only their posts. If they haven't uploaded a photo, show some generic photo. If someone is looking at their own profile, let them upload a photo to the system. Also, when looking at your own profile, a textbox and a button to write a new post. Feed Show the recent 10 posts of everyone in the system. More recent should be on top. You should show the user's photo next to the posts. Clicking on someone's name should take you to their profile page. Post View When a user clicks on the comments/reply button for a post, display the post with replies below it. Have a textbox and button to reply to the post.
In order to use the website users need to be logged in. If they try to access any page and are not logged in, they should be directed to signup or login. Signup Ask the user for their Email, UserName and Password. If their Email is already in use, show an error. The email should have an @ and a. the UserName and Password can not be blank If everything is OK, save their information to a database and automatically log them in. Login Ask for their Email (or UserName) and Password. If something is wrong, show an error. If everything is OK log them into the system and redirect them to the Profile page. Profile Pick a URL to show someone's profile. This could be /profile/username or /@username or /u/username (whatever you'd like). Show the user's photo, UserName and only their posts. If they haven't uploaded a photo, show some generic photo. If someone is looking at their own profile, let them upload a photo to the system. Also, when looking at your own profile, a textbox and a button to write a new post. Feed Show the recent 10 posts of everyone in the system. More recent should be on top. You should show the user's photo next to the posts. Clicking on someone's name should take you to their profile page. Post View When a user clicks on the comments/reply button for a post, display the post with replies below it. Have a textbox and button to reply to the post.
Chapter7: Developing An Excel Application
Section: Chapter Questions
Problem 4.7CP
Related questions
Question
Can someone take a look at my login and signup and tell me if I'm on the right track or doing this completely wrong, please. For context, I'm working on pythonanywhere and using flask.
@app.route('/login')
def login():
email = request.form.get("email")
password = request.form.get("password")
table = get_table("Users")
item = table.get_item(Key={"email":email})
if 'Item' not in item:
return {'result': 'Email not found.'}
user = item['Item']
if password != user['password']:
return {'result' : "Password does not match."}
session["email"] = user["email"]
session["username"] = user["username"]
result = {'result' : 'OK'}
response = make_response(result)
remember = request.form.get("remember")
if remember == "no":
response.set_cookie("remember", "")
else:
key = str(uuid.uuid4())
table = get_table("Remember")
table.put_item(Item={"key": key, "email": user["email"]})
response.set_cookie("remember", key, max_age=60*60*24*14) # Remember for 14 days
return response
# Route for user signup
@app.route('/signup')
def signup():
email = request.form.get("email")
username = request.form.get("username")
password = request.form.get("password")
# Check if email already exists
table = get_table("Users")
item = table.get_item(Key={"email":email})
if 'Item' in item:
return {'result' : 'Email already in use.'}
# Save user data to database
table.put_item(Item={"email": email, "username": username, "password": password})
# Log in the user automatically after signup
session["email"] = email
session["username"] = username
return redirect("/profile")
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
Unlock instant AI solutions
Tap the button
to generate a solution
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning