Ejemplo n.º 1
0
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)))
Ejemplo n.º 2
0
 def __init__(self):
     self.exit = False
     self.snake = snake(self)
     self.user = user(self)
     self.fruitGenerator = fruitGenerator(self)
     self.fruitBasket = []
     self.bodyCollision = False
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
 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
Ejemplo n.º 5
0
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