-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,22 @@ | ||
|
||
# A very simple Flask Hello World app for you to get started with... | ||
import os | ||
from flask import Flask, render_template, request | ||
from flask_wtf import FlaskForm | ||
from wtforms import StringField, PasswordField | ||
from wtforms.validators import DataRequired | ||
|
||
from flask import Flask | ||
class MyForm(FlaskForm): | ||
name = StringField('name', validators=[DataRequired()]) | ||
password = PasswordField('password', validators=[DataRequired()]) | ||
|
||
app = Flask(__name__) | ||
app.config['SECRET_KEY'] = os.urandom(12).hex() | ||
|
||
@app.route('/') | ||
@app.route('/', methods=['GET', 'POST']) | ||
def hello_world(): | ||
return "Hello from Between2Cracks!" | ||
form = MyForm() | ||
if request.method == 'POST': | ||
print(form.name.data, form.password.data) | ||
return render_template('form.html', form=form) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Flask==2.1.2 | ||
Flask-WTF==1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html> | ||
<head></head> | ||
<body> | ||
<h1>Hello, Between2Cracks!</h1> | ||
<form method="POST" action="/"> | ||
{{ form.csrf_token }} | ||
{{ form.name.label }} {{ form.name(size=20) }} | ||
{{ form.password.label }} {{ form.password(size=20) }} | ||
<input type="submit" value="Go"> | ||
</form> | ||
</body> | ||
</html> |