コード例 #1
0
    def setUp(self):
        global factory 
        global example_user_1
        factory = dao_factory.get_instance(life_score_test_database)
        example_user_1 = user_bean("Gregory","Daniels","*****@*****.**", "Papa2k15", "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8")
        try:
            con = lite.connect(life_score_test_database)
            with con:
                cur = con.cursor()
                cur.executescript(
                    """
                    DROP TABLE IF EXISTS "user";

                    CREATE TABLE "user" (
                    `userID`    INTEGER UNIQUE,
                    `name`    TEXT NOT NULL,
                    `username`    TEXT NOT NULL,
                    `email`    TEXT NOT NULL,
                    `password`    TEXT NOT NULL,
                    PRIMARY KEY(userID)
                    )""")
                con.commit()
        except lite.Error, e:
            return str(e)
コード例 #2
0
from flask import Flask, redirect
from flask.templating import render_template
import hashlib
from flask.globals import request, session
from dao.dao_factory import dao_factory
from beans.user_bean import user_bean
from beans.user_info_bean import user_info_bean
import time
from datetime import date
from beans.mission_bean import mission_bean

lifescore = Flask(__name__)
lifescore.secret_key = "lifescore"
factory = dao_factory.get_instance()


@lifescore.route("/")
def login_page():
    return render_template("index.html")


@lifescore.route("/register")
def registration():
    return render_template("register.html")


@lifescore.route("/register_user/", methods=["POST"])
def register_new_user():
    first_name = request.form["first_name"]
    last_name = request.form["last_name"]
    username = request.form["username"]