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


Python Secret.create_secret方法代码示例

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


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

示例1: make_api_key

# 需要导入模块: from community_share.models.secret import Secret [as 别名]
# 或者: from community_share.models.secret.Secret import create_secret [as 别名]
 def make_api_key(self):
     secret_data = {
         'userId': self.id,
         'action': 'api_key',
     }
     secret = Secret.create_secret(info=secret_data, hours_duration=24)
     return secret
开发者ID:seanastephens,项目名称:communityshare,代码行数:9,代码来源:user.py

示例2: request_password_reset

# 需要导入模块: from community_share.models.secret import Secret [as 别名]
# 或者: from community_share.models.secret.Secret import create_secret [as 别名]
def request_password_reset(user):
    secret_info = {
        'userId': user.id,
        'action': 'password_reset',
    }
    hours_duration = 48
    secret = Secret.create_secret(secret_info, hours_duration)
    content = '''We received a request to reset your password for CommunityShare.
    
To reset your password please click on the following link and follow the instructions.
    
{BASEURL}/#/resetpassword?key={secret_key}
    
If you cannot click on the link copy it into the addressbar of your browser.
'''
    content = content.format(BASEURL=config.BASEURL, secret_key=secret.key)
    if not user.email_confirmed:
        error_message = 'The email address is not confirmed.'
    else:
        email = mail.Email(
            from_address=config.DONOTREPLY_EMAIL_ADDRESS,
            to_address=user.confirmed_email,
            subject='CommunityShare Password Reset Request',
            content=content,
            new_content=content,
        )
        error_message = mail.get_mailer().send(email)
    return error_message
开发者ID:TimmyTomTom,项目名称:commshare,代码行数:30,代码来源:mail_actions.py

示例3: request_password_reset

# 需要导入模块: from community_share.models.secret import Secret [as 别名]
# 或者: from community_share.models.secret.Secret import create_secret [as 别名]
def request_password_reset(user):
    secret_info = {
        'userId': user.id,
        'action': 'password_reset',
    }
    hours_duration = 48
    secret = Secret.create_secret(secret_info, hours_duration)
    url = '{BASEURL}/#/resetpassword?key={secret_key}'.format(
        BASEURL=config.BASEURL, secret_key=secret.key)
    content = '''<p>We received a request to reset your password for CommunityShare.</p>
    
<p>To reset your password please click on the following link and follow the instructions.</p>
    
<a href={url}>{url}</a>
    
<p>If you cannot click on the link copy it into the addressbar of your browser.</p>
'''
    content = content.format(url=url)
    email = mail.Email(
        from_address=config.DONOTREPLY_EMAIL_ADDRESS,
        to_address=user.email,
        subject='CommunityShare Password Reset Request',
        content=content,
        new_content=content,
        )
    error_message = mail.get_mailer().send(email)
    return error_message
开发者ID:benreynwar,项目名称:communityshare,代码行数:29,代码来源:mail_actions.py

示例4: request_signup_email_confirmation

# 需要导入模块: from community_share.models.secret import Secret [as 别名]
# 或者: from community_share.models.secret.Secret import create_secret [as 别名]
def request_signup_email_confirmation(user):
    secret_info = {
        'userId': user.id,
        'email': user.email,
        'action': 'email_confirmation',
    }
    hours_duration = 48
    secret = Secret.create_secret(secret_info, hours_duration)
    content = '''A community share account has been created and attached to this email address.

To confirm that you created the account, please click on the following link.

{BASEURL}/#/confirmemail?key={secret_key}

If you did not create this account, simply ignore this email.
'''
    content = content.format(BASEURL=config.BASEURL, secret_key=secret.key)
    email = mail.Email(
        from_address=config.DONOTREPLY_EMAIL_ADDRESS,
        to_address=user.email,
        subject='CommunityShare Account Creation',
        content=content,
        new_content=content
    )
    error_message = mail.get_mailer().send(email)
    return error_message
开发者ID:TimmyTomTom,项目名称:commshare,代码行数:28,代码来源:mail_actions.py

示例5: request_signup_email_confirmation

# 需要导入模块: from community_share.models.secret import Secret [as 别名]
# 或者: from community_share.models.secret.Secret import create_secret [as 别名]
def request_signup_email_confirmation(user, template=None, subject=None):
    secret_info = {
        'userId': user.id,
        'email': user.email,
        'action': 'email_confirmation',
    }
    hours_duration = 24*14
    secret = Secret.create_secret(secret_info, hours_duration)
    url = '{BASEURL}/#/confirmemail?key={secret_key}'.format(
        BASEURL=config.BASEURL, secret_key=secret.key)
    if template is None:
        template = '''<p>A community share account has been created and attached to this email address.<p>

        <p>To confirm that you created the account, please click on the following link.</p>

        <p><a href={url}>{url}</a></p>

        <p>If you did not create this account, simply ignore this email.</p>
'''
    content = template.format(url=url)
    if subject is None:
        subject = 'CommunityShare Account Creation'
    email = mail.Email(
        from_address=config.DONOTREPLY_EMAIL_ADDRESS,
        to_address=user.email,
        subject=subject,
        content=content,
        new_content=content
    )
    error_message = mail.get_mailer().send(email)
    return error_message
开发者ID:benreynwar,项目名称:communityshare,代码行数:33,代码来源:mail_actions.py


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