Python flask_script 模块,prompt_pass() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用flask_script.prompt_pass()

项目:NodeDefender    作者:CTSNE    | 项目源码 | 文件源码
def create(email, password):
    'Create User Account'
    if email is None:
        email = prompt('Email')

    if password is None:
        password = prompt_pass('Password')

    try:
        NodeDefender.db.user.create(email)
        NodeDefender.db.user.set_password(email, password)
        NodeDefender.db.user.enable(email)
    except ValueError:
        print("User already present")
        return

    print("User {} Successfully added!".format(email))
项目:flask-vue-example    作者:levi-lq    | 项目源码 | 文件源码
def run(self):
        username = prompt("??????")
        with app.app_context():
            g_db = db.session
            while True:
                old_user = models.User.query.filter_by(username=username).first()
                if old_user:
                    print "?????"
                    username = prompt("????????")
                else:
                    break
            nickname = prompt("?????")
            while True:
                password = prompt_pass("?????")
                confirm_password = prompt_pass("??????")
                if password != confirm_password:
                    print "????, ???????"
                    continue
                break

            super_user = models.User(username, nickname, password, "", is_superuser=True)
            g_db.add(super_user)
            g_db.commit()
            print super_user.create_date.strftime("%Y%m%d%H%M%S")
            print "???????%s??" % username
项目:flask-boilerplate    作者:MarcFord    | 项目源码 | 文件源码
def run(self):
        email = prompt('Email Address')
        password = prompt_pass('Password')
        if password == prompt_pass('Confirm Password'):
            user = app.user_datastore.create_user(email=email, password=encrypt_password(password))
            app.user_datastore.activate_user(user)
            db.session.commit()
            self.stdout.write('New User Created, <{id} : {email}>'.format(id=user.id, email=user.email))
        else:
            self.stderr.write('Passwords did not match!')
项目:mybookshelf2    作者:izderadicka    | 项目源码 | 文件源码
def read_pwd():
    password = prompt_pass('Password')
    again = prompt_pass('Repeat password')
    if password != again:
        raise InvalidCommand('Repeated password differs!')
    return password