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


Python Page.confirmation_value方法代码示例

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


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

示例1: UserResetPassword

# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import confirmation_value [as 别名]
def UserResetPassword(request, pk=None, process=False):

    s = Auth().isAuth(request)
    if s is False:
        return Auth.routeLogin

    second_base_url = ''

    try:
        obj = Users.objects.get(pk=pk)
    except KeyError:
        return HttpResponseRedirect('/404/hack/')

    link = {
        'go':  base_url_admin+second_base_url+'reset-password/process/'+str(pk)+'/',
        'cancel':  base_url_admin+second_base_url
    }
    page = Page(request)
    page.confirmation_value = "Reset Password"

    if not process:
        page.description = 'You are about to reset <b>%s</b>\'s password. How do you want to proceed?' % obj.username
        return render_to_response(
            'layout/snippets/delete-confirmation.html',
            {'link': link, 'page': page},
            context_instance=RequestContext(request)
        )

    elif process:
        obj.password = sha1("password").hexdigest()
        obj.save()
        return HttpResponseRedirect(base_url_admin+second_base_url)
开发者ID:pukonu,项目名称:doas,代码行数:34,代码来源:views.py

示例2: get_reset_password

# 需要导入模块: from packages.bin.bin import Page [as 别名]
# 或者: from packages.bin.bin.Page import confirmation_value [as 别名]
    def get_reset_password(self, request, pk=None, do=None):

        s = Auth().is_auth(request)
        if not s:
            return Auth.routeLogin

        from packages.bin.bin import get_company

        second_base_url = ''

        try:
            obj = self.model.pp.get(pk=pk)
        except KeyError:
            return HttpResponseRedirect('#404/hack/')

        link = {'go': self.base_url+second_base_url+'reset-password/process/'+str(pk)+'/',
                'cancel': self.base_url+second_base_url}
        page = Page(request)
        page.confirmation_value = "Reset Password"

        if not do:
            page.description = 'You are about to reset <b>%s</b>\'s password. How do you want to proceed?' % obj.email
            return render_to_response(
                request.session['style'] + '/layout/snippets/delete-confirmation-modal.html',
                {'link': link, 'page': page},
                context_instance=RequestContext(request)
            )

        elif do:
            from packages.bin.email import Email

            # send mail
            company = get_company(user=obj)
            raw_password = obj.reset_password()

            data = dict()
            data['request'] = request
            data['password'] = "%s: <strong>%s</strong>" % (_("New Password"), raw_password)
            data['company'] = company
            try:
                data['logo'] = company.company_logo_raw.url
            except (AttributeError, ValueError):
                data['logo'] = None
            data['email'] = obj.email
            data['link'] = "/system/login/"
            data['title'] = _("Password Reset")
            data['info'] = \
                _("Hi <strong>%s</strong>, your password for PostPrincipal ERP Ontogeny was reset "
                  "successfully, to login please use the temporary generated password below") % \
                obj.profile.get_fullname()

            subject = _("Password Reset Confirmation - %s" % company.company_name)
            email_object = Email(
                request, to=[obj.email], subject=subject, data=data
            )
            email_object.email_template = "system/email/reset-password.html"
            email_object.auth_email = company.auth_email
            email_object.auth_password = company.auth_password
            email_object.smtp_host = company.smtp_host
            email_object.smtp_port = company.smtp_port
            email_object.use_tls = company.use_tls
            email_object.send()

            # notify user of success
            msg = _("User password was reset successfully")
            return HttpResponse(response_success(route='/system/users/', response=msg))
开发者ID:pukonu,项目名称:onc,代码行数:68,代码来源:controllers.py


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