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


Python User.User类代码示例

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


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

示例1: create_message

 def create_message(from_user_email,
                    to_user_email,
                    message_subject,
                    message_body):
     """
     Add a new message to the datastore
     """
     from_user_ref = User.get_by_key_name(from_user_email)
     to_user_ref = User.get_by_key_name(to_user_email)
     new_message = Message(fromUser=from_user_ref,
                           toUser=to_user_ref,
                           subject=message_subject,
                           body=message_body)
     new_message.put()
开发者ID:patricknaish,项目名称:comp3001,代码行数:14,代码来源:Message.py

示例2: admin

def admin():
    status = ["default", "none"]
    if Configuration.loginRequired():
        if not current_user.is_authenticated():
            return render_template('login.html', status=status)
        else:
            return render_template('admin.html', status=status, stats=adminStats())
    else:
        person = User.get("_dummy_")
        login_user(person)
        return render_template('admin.html', status=status, stats=adminStats())
开发者ID:crudbug,项目名称:cve-search,代码行数:11,代码来源:index.py

示例3: login_check

def login_check():
    # validate username and password
    username = request.form.get('username')
    password = request.form.get('password')
    person = User.get(username)
    try:
        if person and pbkdf2_sha256.verify(password, person.password):
            login_user(person)
            return render_template('admin.html', status=["logged_in", "success"], stats=adminStats())
        else:
            return render_template('login.html', status=["wrong_combination", "warning"])
    except:
        return render_template('login.html', status=["outdated_database", "error"])
开发者ID:crudbug,项目名称:cve-search,代码行数:13,代码来源:index.py

示例4: login_check

def login_check():
    # validate username and password
    username = request.form.get('username')
    password = request.form.get('password')
    person = User.get(username)
    try:
        if person and pbkdf2_sha256.verify(password, person.password):
            login_user(person)
            return render_template('admin.html', status="logged_in", **adminInfo())
        else:
            return render_template('login.html', status="wrong_user_pass")
    except:
        return render_template('login.html', status="outdated_database")
开发者ID:jefflaporte,项目名称:cve-search,代码行数:13,代码来源:index.py

示例5: admin

def admin():
    if Configuration.loginRequired():
        if not current_user.is_authenticated():
            return render_template('login.html')
    else:
        person = User.get("_dummy_")
        login_user(person)
    output = None
    if os.path.isfile(Configuration.getUpdateLogFile()):
        with open(Configuration.getUpdateLogFile()) as updateFile:
            separator="==========================\n"
            output=updateFile.read().split(separator)[-2:]
            output=separator+separator.join(output)
    return render_template('admin.html', status="default", stats=adminStats(), updateOutput=filterUpdateField(output))
开发者ID:axeliniyes,项目名称:cveScript,代码行数:14,代码来源:index.py

示例6: login_check

 def login_check(self):
   # validate username and password
   username = request.form.get('username')
   password = request.form.get('password')
   person = User.get(username, self.auth_handler)
   try:
     if person and person.authenticate(password):
       login_user(person)
       return render_template('admin.html', status="logged_in", **self.adminInfo())
     else:
       return render_template('login.html', status="wrong_user_pass")
   except Exception as e:
     print(e)
     return render_template('login.html', status="outdated_database")
开发者ID:adulau,项目名称:cve-search,代码行数:14,代码来源:index.py

示例7: load_user

def load_user(id):
    return User.get(id)
开发者ID:crudbug,项目名称:cve-search,代码行数:2,代码来源:index.py

示例8: load_user

 def load_user(self, id):
   return User.get(id, self.auth_handler)
开发者ID:adulau,项目名称:cve-search,代码行数:2,代码来源:index.py


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