Esempio n. 1
0
 def regist_user(self, username, password):
     """
     登録
     """
     user = User(username=username)
     if user.exist():
         return USER_EXIST
     user.setvalue('username', username)
     user.setvalue('nickname', u'名無し')
     user.reset_hash()
     if not user.reset_password(new_password=password, salt=self.setting['password']['salt'], force=True):
         return PASSWORD_ERROR
     if user.insert():
         self.user = user;
         return REGIST_CORRECT
     return OTHER_ERROR
Esempio n. 2
0
 def regist_user(self, username, password):
     """
     登録
     """
     user = User(username=username)
     if user.exist():
         return USER_EXIST
     user.setvalue('username', username)
     user.setvalue('nickname', u'名無し')
     user.reset_hash()
     if not user.reset_password(new_password=password,
                                salt=self.setting['password']['salt'],
                                force=True):
         return PASSWORD_ERROR
     if user.insert():
         self.user = user
         return REGIST_CORRECT
     return OTHER_ERROR
Esempio n. 3
0
from flask import render_template, request, redirect, url_for
from app import app

#imports the user class from the libraries folder to be
#able to use the user methods
from lib.user import User 

#Creates a new user and checks if the user exists
user = User('*****@*****.**', 'awesomesauce')
user.exist()

#gets username
username = user.getName()

#The following code uses flask methods to communicate between
#the database via the user class and the html pages using Jinja2 
#variables 

@app.route('/', methods=['GET', 'POST'])
@app.route('/index.html', methods=['GET', 'POST'])
def index():

	#gets the grocery lists associated
	#with the user
	glists = user.getGListsItemList()

	#gets a lists of names for all the user's grocery lists
	gListNames = user.getGListsNames()
	
	#Post requests in flask mean that the user has clicked on a button or link 
Esempio n. 4
0
from flask import render_template, request, redirect, url_for
from app import app

#imports the user class from the libraries folder to be
#able to use the user methods
from lib.user import User

#Creates a new user and checks if the user exists
user = User('*****@*****.**', 'awesomesauce')
user.exist()

#gets username
username = user.getName()

#The following code uses flask methods to communicate between
#the database via the user class and the html pages using Jinja2
#variables


@app.route('/', methods=['GET', 'POST'])
@app.route('/index.html', methods=['GET', 'POST'])
def index():

    #gets the grocery lists associated
    #with the user
    glists = user.getGListsItemList()

    #gets a lists of names for all the user's grocery lists
    gListNames = user.getGListsNames()

    #Post requests in flask mean that the user has clicked on a button or link