from flask import Flask
from flask import render_template
from flask import request


app = Flask(__name__)

loginTable = { 
               'tom' : 'mot',
               'sue' : 'eus',
               'jim' : 'mij'
              }

def is_valid_login(username, password):
    if username in loginTable: 
        return loginTable[username] == password
    else:
        return False

def log_the_user_in(name):
    return render_template('successful_login.html', name=name)

def dont_log_the_user_in(name):
    return render_template('unsuccessful_login.html', name=name)


@app.route('/')
def try_to_login(name=None):
    return render_template('try_to_login.html', name=name)


@app.route('/login', methods=['POST', 'GET'])
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.request.form['password']
    if request.method == 'GET':
        username = request.args.get('username', 'jim')
        password = request.args.get('password', 'mij')
    if is_valid_login(username, password):
        return log_the_user_in(username)
    else:
        return dont_log_the_user_in(username)


if __name__ == "__main__":
    print("serving on localhost, port 5000")
#    app.debug = True
    app.run()

e61bc7520f8a8676aefdcc354fbf8e2f1f81097e
<mask token>


def is_valid_login(username, password):
    if username in loginTable:
        return loginTable[username] == password
    else:
        return False


def log_the_user_in(name):
    return render_template('successful_login.html', name=name)


def dont_log_the_user_in(name):
    return render_template('unsuccessful_login.html', name=name)


@app.route('/')
def try_to_login(name=None):
    return render_template('try_to_login.html', name=name)


@app.route('/login', methods=['POST', 'GET'])
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.request.form['password']
    if request.method == 'GET':
        username = request.args.get('username', 'jim')
        password = request.args.get('password', 'mij')
    if is_valid_login(username, password):
        return log_the_user_in(username)
    else:
        return dont_log_the_user_in(username)


<mask token>

<mask token>


def is_valid_login(username, password):
    if username in loginTable:
        return loginTable[username] == password
    else:
        return False


def log_the_user_in(name):
    return render_template('successful_login.html', name=name)


def dont_log_the_user_in(name):
    return render_template('unsuccessful_login.html', name=name)


@app.route('/')
def try_to_login(name=None):
    return render_template('try_to_login.html', name=name)


@app.route('/login', methods=['POST', 'GET'])
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.request.form['password']
    if request.method == 'GET':
        username = request.args.get('username', 'jim')
        password = request.args.get('password', 'mij')
    if is_valid_login(username, password):
        return log_the_user_in(username)
    else:
        return dont_log_the_user_in(username)


if __name__ == '__main__':
    print('serving on localhost, port 5000')
    app.run()

<mask token>
app = Flask(__name__)
loginTable = {'tom': 'mot', 'sue': 'eus', 'jim': 'mij'}


def is_valid_login(username, password):
    if username in loginTable:
        return loginTable[username] == password
    else:
        return False


def log_the_user_in(name):
    return render_template('successful_login.html', name=name)


def dont_log_the_user_in(name):
    return render_template('unsuccessful_login.html', name=name)


@app.route('/')
def try_to_login(name=None):
    return render_template('try_to_login.html', name=name)


@app.route('/login', methods=['POST', 'GET'])
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.request.form['password']
    if request.method == 'GET':
        username = request.args.get('username', 'jim')
        password = request.args.get('password', 'mij')
    if is_valid_login(username, password):
        return log_the_user_in(username)
    else:
        return dont_log_the_user_in(username)


if __name__ == '__main__':
    print('serving on localhost, port 5000')
    app.run()

from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
loginTable = {'tom': 'mot', 'sue': 'eus', 'jim': 'mij'}


def is_valid_login(username, password):
    if username in loginTable:
        return loginTable[username] == password
    else:
        return False


def log_the_user_in(name):
    return render_template('successful_login.html', name=name)


def dont_log_the_user_in(name):
    return render_template('unsuccessful_login.html', name=name)


@app.route('/')
def try_to_login(name=None):
    return render_template('try_to_login.html', name=name)


@app.route('/login', methods=['POST', 'GET'])
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.request.form['password']
    if request.method == 'GET':
        username = request.args.get('username', 'jim')
        password = request.args.get('password', 'mij')
    if is_valid_login(username, password):
        return log_the_user_in(username)
    else:
        return dont_log_the_user_in(username)


if __name__ == '__main__':
    print('serving on localhost, port 5000')
    app.run()

from flask import Flask
from flask import render_template
from flask import request


app = Flask(__name__)

loginTable = { 
               'tom' : 'mot',
               'sue' : 'eus',
               'jim' : 'mij'
              }

def is_valid_login(username, password):
    if username in loginTable: 
        return loginTable[username] == password
    else:
        return False

def log_the_user_in(name):
    return render_template('successful_login.html', name=name)

def dont_log_the_user_in(name):
    return render_template('unsuccessful_login.html', name=name)


@app.route('/')
def try_to_login(name=None):
    return render_template('try_to_login.html', name=name)


@app.route('/login', methods=['POST', 'GET'])
def login():
    if request.method == 'POST':
        username = request.form['username']
        password = request.request.form['password']
    if request.method == 'GET':
        username = request.args.get('username', 'jim')
        password = request.args.get('password', 'mij')
    if is_valid_login(username, password):
        return log_the_user_in(username)
    else:
        return dont_log_the_user_in(username)


if __name__ == "__main__":
    print("serving on localhost, port 5000")
#    app.debug = True
    app.run()
