当前位置: 首页>>代码示例>>Python>>正文


Python User.password方法代码示例

本文整理汇总了Python中user.User.password方法的典型用法代码示例。如果您正苦于以下问题:Python User.password方法的具体用法?Python User.password怎么用?Python User.password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在user.User的用法示例。


在下文中一共展示了User.password方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestUser

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
class TestUser(unittest.TestCase):

    def setUp(self):
        self.user = User()

    def test_signin(self):
        self.user.signin('atai.zh', '123456789')
        self.assertEqual(self.user.login, 'atai.zh')
        self.assertEqual(self.user.password, '123456789')

    def test_reset_password(self):
        self.user.password('987654321')
        self.assertEqual(self.user.password, '987654321')
开发者ID:Atai4ik,项目名称:authentication,代码行数:15,代码来源:tests.py

示例2: test_password_hashing

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
    def test_password_hashing(self):
        password = "test+password"
        hashed = User.password_hashing(password)
        user = User()
        user.password = hashed

        self.assertTrue(user.check_password(password))
        self.assertFalse(user.check_password(password+"1"))
        self.assertFalse(user.check_password(password[:-1]))
开发者ID:frm-system,项目名称:frm,代码行数:11,代码来源:test_user.py

示例3: manage_users_edit

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
def manage_users_edit(name=None):
    if request.method == 'GET':
        error = None
        u = User()
        u.name = name
        u = get_user(u)

        if u is None:
            error = "User existiert nicht"

        return render_template('manage_users_edit.html', user_to_edit=u, error=error, user=get_user_by_name(session.get('name')))

    if request.method == 'POST':
        u = User()
        #print request.form
        u.id = request.form['id']
        u.name = request.form['username'].lower()
        u.longname=request.form['longname']
        u.email = request.form['email']
        u.rfid_id = request.form['rfid_id']

        if 'isblack' in request.form:
            u.isblack = True
        else:
            u.isblack = False

        if 'isbaron' in request.form:
            u.isbaron = True
        else:
            u.isbaron = False

        if 'isshown' in request.form:
            u.isshown = True
        else:
            u.isshown = False

        if 'autoblack' in request.form:
            u.autoblack = True
        else:
            u.autoblack = False

        if 'onlyrfid' in request.form:
            u.onlyrfid = True
        else:
            u.onlyrfid = False

        u2 = get_user_by_id(u.id)
        u.password = u2.password

        update_user(u)

        return redirect('/manage_users')
开发者ID:ulrichknecht,项目名称:baroness,代码行数:54,代码来源:views.py

示例4: get_user_by_id

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
def get_user_by_id(id):
    row = query_db("SELECT * FROM USERS WHERE ID = ?", [id], one=True)
    u = User()
    if row is None:
        return None
    u.id=row[0]
    u.name=row[1]
    u.password=row[2]
    u.longname=row[3]
    u.email=row[4]
    u.isblack=row[5]
    u.isbaron=row[6]
    u.isshown=row[7]
    u.autoblack=row[8]
    u.onlyrfid=row[9]
    u.rfid_id = get_rfid_ids_by_userid(u.id)
    logging.debug(u)
    return u
开发者ID:ulrichknecht,项目名称:baroness,代码行数:20,代码来源:database.py

示例5: get_users

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
def get_users():
    rows = query_db("SELECT * FROM USERS")
    users = []
    for row in rows:
        u = User()
        u.id=row[0]
        u.name=row[1]
        u.password=row[2]
        u.longname=row[3]
        u.email=row[4]
        u.isblack=row[5]
        u.isbaron=row[6]
        u.isshown=row[7]
        u.autoblack=row[8]
        u.onlyrfid=row[9]
        u.rfid_id = get_rfid_ids_by_userid(u.id)
        users.append(u)
    return users
开发者ID:ulrichknecht,项目名称:baroness,代码行数:20,代码来源:database.py

示例6: register_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
 def register_user(self, name, last_name, city, age, email, login, password, secret_word):
     # if email in self.emails:
     #     print('This email is already used')
     #     return
     if login in self.users:
         print('This login is already taken')
         return
     # self.emails.add(email)
     new_user = User()
     new_user.name = name
     new_user.last_name = last_name
     new_user.city = city
     new_user.age = age
     new_user.email = email
     new_user.login = login
     new_user.password = password
     new_user.secret_word = secret_word
     self.users[login] = new_user
     print('registration successful')
开发者ID:cl0ne,项目名称:kpi-educational-tasks,代码行数:21,代码来源:registration_old.py

示例7: fun_check

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
def fun_check(email, token, kind):
    
    tmp = User.is_exist(email=email)
    if tmp is False:
        return [1,'用户不存在!']
    usr = User(email=email)
    if usr.token == token:
        usr.password = token[:40]
        usr.token = ''
        try:
            AFW_Group = BasicGroup(_id=AFWConfig.afewords_group_id)
            usr.follow_group(AFW_Group)
        except Exception:
            logging.error(traceback.format_exc())
        return [0,'']
    if kind == "mail":
        return [1, "抱歉,邮箱验证失败!"]
    else:
        return [1, "抱歉,密码重置失败!"]
开发者ID:deju,项目名称:afw_old,代码行数:21,代码来源:AF_LoginTool.py

示例8: manage_users_add

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
def manage_users_add():
    if request.method == 'POST':
        u = User()
        error = None
        u.name = request.form['username'].lower()
        if u.name is None:
            error = "Username not unique!"

        if request.form['password1'] == request.form['password2']:
            #u.password = request.form['password1']
            u.password = bcrypt.hashpw(request.form['password1'], bcrypt.gensalt())
        else:
            error = "Passwords do not match!"
        u.longname = request.form['longname']
        u.email = request.form['email']
        u.rfid_id = request.form['rfid_id']

        if error is None:
            add_user(u)
            return render_template('manage_users_add.html', success="User created!", user=get_user_by_name(session.get('name')));

        return render_template('manage_users_add.html', error=error, user=get_user_by_name(session.get('name')))
    return render_template('manage_users_add.html', user=get_user_by_name(session.get('name')))
开发者ID:ulrichknecht,项目名称:baroness,代码行数:25,代码来源:views.py

示例9: sign_up_clicked

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
    def sign_up_clicked(self):
        self.line_edits = []
        self.line_edits.append(self.lineEditPassword)
        self.line_edits.append(self.lineEditName)
        self.line_edits.append(self.lineEditLastName)
        self.line_edits.append(self.lineEditAge)
        self.line_edits.append(self.lineEditWeight)
        self.line_edits.append(self.lineEditUsername)
        self.line_edits.append(self.lineEditPassword)

        self.label_validation.setText("")
        for line_edit in self.line_edits:
            if line_edit.text() == "":
                self.label_validationSign.setText("All fields required.")
                return

        new_user = User()

        new_user.first_name = str(self.lineEditName.text())
        new_user.last_name = str(self.lineEditLastName.text())
        new_user.age = int(self.lineEditAge.text())
        new_user.weight = int(self.lineEditWeight.text())
        new_user.user_name = str(self.lineEditUsername.text())
        new_user.password = str(self.lineEditPassword.text())

        error = database.insert_user(new_user)

        if error:

            if isinstance(error, MySQLdb.IntegrityError):
                if "Duplicate entry" in error.args[1]:
                    #If we have a duplicate entry
                    self.label_validation.setText("Sorry that username is already taken.")
        else:
            #If we successfully signed up we should set a message on log in page
            self.stackedWidget.setCurrentIndex(0)
            self.label_validationSign.setText("Sign up SUCCESSFUL!")
开发者ID:recheej,项目名称:Python-Workout-Project,代码行数:39,代码来源:Fitness.py

示例10: raw_input

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import password [as 别名]
                print "Login failed."

        if command == "logout":
            user = None

        elif command == "update":
            if not user:
                print "Please login first"
                continue

            new_email = raw_input("New Email: ")
            new_password = getpass.getpass("New Password: ")

            user.update(new_email, bcrypt.hashpw(new_password, bcrypt.gensalt(10)))
            user.email = new_email
            user.password = new_password

        elif command == "delete":
            if not user:
                print "Please login first"
                continue

            confirm = raw_input("Are you sure? Y/n: ")

            if confirm == "Y" or confirm == "y" or confirm == "yes" or confirm == "Yes":
                print "deleting %s with password %s" % (user.email, user.password)
                
                user.delete()
                user = None

        elif command == "create":
开发者ID:wbthomason,项目名称:cs3240-onedir,代码行数:33,代码来源:one_dir_client.py


注:本文中的user.User.password方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。