Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
digest header generating issue
#2
# simple and reliable
@auth.post("/login")
def auth_login():
    email = request.forms.get("mail")
    pswd = request.forms.get("password")

    if auth_mail(email) is False:
        cur = con.cursor()
        sql = "SELECT id, name, mail, password FROM user_table WHERE mail=?"
        res = cur.execute(sql, (email,))
        row = res.fetchone()
        row.keys()
        cur.close()
        if bcrypt.checkpw(pswd.encode(), row["password"]):
            payload = {
                "id": row["id"],
                "name": row["name"],
                "mail": row["mail"],
            }

            visited = jwt.encode(payload, key, algorithm)
            response.set_cookie(
                "visited",
                visited,
                path="/",
                httponly=True,
            )
            return redirect("/")
        return HTTPError(
            401, "Sorry.. The password doesn't match..!"
        )
    return HTTPError(401, "Sorry.. NO user..!")
Reply


Messages In This Thread
RE: digest header generating issue - by wnesbv - Mar-20-2023, 08:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  malformed header from script 'main.py': Bad header: * Serving Flask app "main" anuragsapanbharat 2 4,613 Jun-12-2019, 07:26 AM
Last Post: anuragsapanbharat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020