本文整理汇总了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)
示例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))