Esempio n. 1
0
 def post(self, *args, **kwargs):
     name = self.get_argument('name')
     pwd = self.get_argument('password')
     new_user = User(name=name,password=pwd)
     session.add(new_user)
     session.commit()
     self.write('新增用户成功~')
Esempio n. 2
0
def regist():
    username = request.form.get('username').strip()
    password = request.form.get('password').strip()

    if username=='' or password=='':
        return redirect_with_msg('/reglogin/',u'用户名密码不能为空','regist')

    user = User.query.filter_by(name=username).first()
    if user != None:
        return redirect_with_msg('/reglogin/', u'用户名已存在', 'regist')

    salt = '.'.join(sample('01234567890abcdefghigABCDEFGHI', 10))
    m = hashlib.md5()
    m.update(password + salt)
    password = m.hexdigest()
    user = User(username,password,salt)
    db.session.add(user)
    db.session.commit()

    login_user(user)
    flash('Regist successfully.')

    next = request.args.get('next')
    print next
    if next != None and next.startwith('/'):
        return redirect(next)
    return redirect_with_msg('/', u'注册成功', 'regist')
Esempio n. 3
0
    def auth(self, username, password):
        if username in self.userData.map_user.keys():
            if password == self.userData.map_user[username][0]:
                id = self.userData.map_user[username][-1]
                self.user = User(id, username, password)

                return self.user

            else:
                messagebox.showerror('error', "wrong password")
        else:
            messagebox.showerror('error', "no account")
Esempio n. 4
0
async def test(loop):
    await orm.create_pool(loop,
                          user='******',
                          password='******',
                          database='awesome')

    u = User(name='Test',
             email='*****@*****.**',
             passwd='1234567890',
             image='about:blank')

    await u.save()
Esempio n. 5
0
def add_user():
    person = User(name='cherish002', password='******')
    session.add(person)  #增加单个
    # session.add_all(
    #     [
    #         User(name='memeda',password='******'),
    #         User(name='lalala',password='******'),
    #         User(name='hahaha',password='******'),
    #     ]
    # )   #增加多个
    session.commit()  #提交
    print(person, '增加成功~')
Esempio n. 6
0
 def insert(number, password):
     user = User("", password, "", number, 0, 0, 0, 0)
     dbSession.add(user)
     dbSession.commit()
     user = dbSession.query(User).filter(User.mobileNo == number).first()
     if user is not None:
         token = user.id + time.mktime(time.localtime())
         user.token = token
         tk = Token(token, User.name, user.id)
         dbSession.add(tk)
         dbSession.commit()
         return user
     else:
         return None
Esempio n. 7
0
def save():
  user = User(3, 'jile')
  user.save()
Esempio n. 8
0
import tkinter as tk
from authentication import Login
from module import User
from data_src import UserData, ActivityData
import schedule as sc
import calendar

# global variabel
root = 0
frame1 = 0
frame2 = 0
usernameEntry = 0
passEntry = 0
newUsernameEntry = 0
newPassEntry = 0
user = User()
log = None


def loginbox():
    global root
    global frame1
    global usernameEntry
    global passEntry

    root = tk.Tk()
    root.geometry("300x120")
    root.resizable(width=False, height=False)

    frame1 = tk.Frame(root, padx=15, pady=15)
    usernameEntry = tk.Entry(frame1, width=30)
Esempio n. 9
0
 def __init__(self):
     self.user = User()
     self.userData = UserData()
     self.activityData = ActivityData()