0

I am developing my mobile app server using flask. And through web page, I am providing page for resetting password. I wrote simple html code, but it shows html code as just strings.

here is my code

<!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 4.01//EN">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Serendipity</title>
</head>
<body>
hello {{ token }}

<form action="/user/reset_password/" method="POST">
        <p>
            email : <input name="email" maxlength="40"/>
        </p>
        <p>
            password : <input name="password" type="password">
        </p>

        <button type="submit">Login</button>
    </form>
</body>
</html>

Here is my flask code:

class ResetPassword(Resource): 
    def get(self, user_id, token): 
        return render_template("reset_password.html", token = token)

And Flask code(I am using flask_restful)

class ResetPassword(Resource):
    def get(self, user_id, token):
        # NOT FOUNT ERROR
        return render_template("reset_password.html", token = token)

It results in like below.

"<!DOCTYPE HTML PUBLIC \"-//W3C/DTD HTML 4.01//EN\">\n<html `lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Serendipity</title>\n</head>\n<body>\nhello eyJhbGciOiJIUzI1NiIsImlhdCI6MTUyODk0ODkyMSwiZXhwIjoxNTI4OTQ5OTIwfQ.eyJpZCI6MTAwNywiZW1haWwiOiJtYWppbm1hbkBrb3JlYS5hYy5rciIsImF1dGhfZW1haWwiOiJtYWppbm1hbkBrb3JlYS5hYy5rciJ9.9S4wiockkcgyrIe8qb6EEnyjK64c8O-dz0J8T3miDkE\n\n<form action=\"/user/reset_password/\" method=\"POST\">\n        <p>\n            email : <input name=\"email\" maxlength=\"40\"/>\n        </p>\n        <p>\n            password : <input name=\"password\" type=\"password\">\n        </p>\n\n        <button type=\"submit\">Login</button>\n    </form>\n</body>\n</html>"`

What's wrong with my code? Please Help me.

Kazaka Nelson
  • 158
  • 3
  • 14

0 Answers0