Esempio n. 1
0
def register_new_user():
    first_name = request.form["first_name"]
    last_name = request.form["last_name"]
    username = request.form["username"]
    email = request.form["email"]
    password = request.form["password"]
    results = factory.get_user_dao().add_new_user(
        user_bean(
            first_name,
            last_name,
            time.strftime("%m/%d/%Y"),
            email,
            username,
            hashlib.sha256(password.encode()).hexdigest(),
        )
    )
    if False not in results:
        factory.get_user_info_dao().add_new_user_info(user_info_bean("", "", "", ""))
    return_message = results[1]
    return_error = not results[0]
    return render_template("index.html", message=return_message, error=return_error)
 def get_user_info(self, _userID):
     con = None
     try:
         con = self.database_connector
         with con:
             con.rollback()
             cur = con.cursor()
             cur.execute("SELECT * FROM userinfo WHERE userID = ?", (_userID,))
             con.commit()
             single_user_info_data = cur.fetchone()
             if single_user_info_data != None:
                 return user_info_bean(
                     single_user_info_data[1],
                     single_user_info_data[2],
                     single_user_info_data[3],
                     single_user_info_data[4],
                     single_user_info_data[0],
                 )
             return single_user_info_data
     except lite.Error, e:
         return False, str(e)