view frontend/mfrontend/views/frontend.py @ 3:79fc37fe85a6

Zabawy z Flaskiem ciąg dalszy, zaczyna to jakoś wyglądać
author michalr
date Tue, 22 Feb 2011 19:25:10 +0000
parents c3fb1e9fc1f7
children cf786ee26a22
line wrap: on
line source

#!/usr/bin/python
# -*- coding: utf-8 -*-

from flask import Module, render_template, request, url_for
from mfrontend import db, utils
frontend = Module(__name__)

@frontend.route('/')
def index():
    lol = db.query_db('select id, username, password from users')
    return lol[0]['username']

@frontend.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'POST':
        return "Uname: {0}<br />Passwd: {1}<br />Hashpwd: {2}".format(
            request.form['username'],
            request.form['password'],
            utils.hashPassword(request.form['password']))
    return render_template('login.html')