def register(): if request.method == 'GET': return render_template('register.html') elif request.method == 'POST': mail = request.form['email'] values = (None, request.form['name'], mail, user.hash_password(request.form['password']), request.form['phone_number'], request.form['address']) user(*values).add_user() return redirect("/{}/".format(user.get_user_id(mail)))
def __init__(self): self.exit = False self.snake = snake(self) self.user = user(self) self.fruitGenerator = fruitGenerator(self) self.fruitBasket = [] self.bodyCollision = False
def tracker(condition,message): if condition=='S': _username=message.from_user.username _userId=str(message.from_user.id) if _userId not in users_id: users_id.append(_userId) users.append(user(_username,_userId)) UserLog.salvaUsers('users.dat',users)
def add_user(self, userName, conn): for u in self.users: if u.get_username() == userName: if u.get_connection is not None: return False else: retVal = [] for r in u.get_chatrooms: retVal.append(r.get_name) return retVal newUser = user(userName, conn) self.users.append(newUser) return True
def readUsers(nomeFile): users=[] fd=open(nomeFile,'r+') #print(fd) file_content=fd.read() user_list_in_file=file_content.splitlines() #print(user) for u in user_list_in_file: if u!='': u=u.split(';') #print('id: '+u[0]+' user:'******'\n') newUser=user(u[0],u[1]) users.append(newUser) fd.close() return users