You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
conn = sqlite3.connect("users.db")
c = conn.cursor()
c.execute("SELECT password FROM users WHERE username=?", (username,))
result = c.fetchone()
conn.close()
if result and bcrypt.checkpw(password, result[0]):
session["user"] = username
return "Login successful!"
else:
return "Invalid credentials."
return render_template("login.html")
@app.route("/logout")
def logout():
session.pop("user", None)
return "Logged out successfully!"
Activity