本文整理汇总了Python中mezzanine.utils.email.send_verification_mail函数的典型用法代码示例。如果您正苦于以下问题:Python send_verification_mail函数的具体用法?Python send_verification_mail怎么用?Python send_verification_mail使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了send_verification_mail函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: signup
def signup(request, template="accounts/account_signup.html",
extra_context=None):
"""
Signup form.
"""
#Staat in admin_forms
form = NewUserCreationForm(request.POST or None, request.FILES or None)
if request.method == "POST" and form.is_valid():
new_user = form.save()
if not new_user.is_active:
if settings.ACCOUNTS_APPROVAL_REQUIRED:
send_approve_mail(request, new_user)
info(request, _("Thanks for signing up! You'll receive "
"an email when your account is activated."))
else:
send_verification_mail(request, new_user, "signup_verify")
info(request, _("A verification email has been sent with "
"a link for activating your account."))
return redirect(next_url(request) or "/")
else:
info(request, _("Successfully signed up"))
auth_login(request, new_user)
return login_redirect(request)
context = {"form": form, "title": _("Sign up")}
context.update(extra_context or {})
return render(request, template, context)
开发者ID:nigelvanherwijnen,项目名称:nsawebdev,代码行数:26,代码来源:views_backup.py
示例2: signup
def signup(request, template="accounts/account_signup.html"):
"""
Signup form.
"""
profile_form = get_profile_form()
form = profile_form(request.POST or None, request.FILES or None)
if request.method == "POST" and form.is_valid():
new_user = form.save()
if not new_user.is_active:
if settings.ACCOUNTS_APPROVAL_REQUIRED:
send_approve_mail(request, new_user)
info(request, _("Thanks for signing up! You'll receive "
"an email when your account is activated."))
else:
send_verification_mail(request, new_user, "signup_verify")
info(request, _("A verification email has been sent with "
"a link for activating your account."))
return redirect(request.GET.get("next", "/"))
else:
info(request, _("Successfully signed up"))
auth_login(request, new_user)
return login_redirect(request)
else:
log.debug('Form is not valid. Errors: %s' % form.errors)
context = {"form": form, "title": _("Create an Account"), "submit_label": "Next Step"}
return render(request, template, context)
开发者ID:orlenko,项目名称:sfpirg,代码行数:26,代码来源:views.py
示例3: retail_signup
def retail_signup(request, template="accounts/retail_signup.html"):
form = ProfileForm(request.POST or None)
if request.method == "POST" and form.is_valid():
new_user = form.save()
# Add to campaign monitor
if bool(form.cleaned_data.get("optin")):
cm_api = CampaignMonitorApi(settings.CM_API_KEY, settings.CM_CLIENT_ID)
listid = settings.CM_RETAIL_LIST_ID
custom_fields = {}
#try:
cm_api.subscriber_add(
listid,
form.cleaned_data.get("email"),
form.cleaned_data.get("first_name") + ' ' + form.cleaned_data.get("last_name"),
custom_fields=custom_fields)
#except:
# pass
if not new_user.is_active:
send_verification_mail(request, new_user, "signup_verify")
info(request, "A verification email has been sent with a link for activating your account.")
else:
info(request, "Successfully signed up")
auth_login(request, new_user)
return my_login_redirect(request)
context = {"form": form, "title": "Customer Registration"}
return render(request, template, context)
开发者ID:zs425,项目名称:Manai-python-,代码行数:28,代码来源:views.py
示例4: account
def account(request, template="account.html"):
"""
Display and handle both the login and signup forms.
"""
login_form = LoginForm(request)
signup_form = SignupForm(request)
if request.method == "POST":
posted_form = None
message = ""
if request.POST.get("login") is not None:
login_form = LoginForm(request, request.POST)
if login_form.is_valid():
posted_form = login_form
message = _("Successfully logged in")
else:
signup_form = SignupForm(request, request.POST)
if signup_form.is_valid():
new_user = signup_form.save()
if not new_user.is_active:
send_verification_mail(request, new_user)
info(request, _("A verification email has been sent with " "a link for activating your account."))
else:
posted_form = signup_form
message = _("Successfully signed up")
if posted_form is not None:
posted_form.login(request)
info(request, message)
return redirect(request.GET.get("next", "/"))
context = {"login_form": login_form, "signup_form": signup_form}
return render(request, template, context)
开发者ID:NeoChronos,项目名称:mezzanine,代码行数:30,代码来源:views.py
示例5: signup
def signup(request, template="accounts/account_signup.html"):
"""
Signup form.
"""
profile_form = UserRegistrationLeadForm
form = profile_form(request.POST or None, request.FILES or None)
if request.method == "POST" and form.is_valid():
data = form.cleaned_data.copy()
# ensure user is not a robot
honeypot = data.pop('superpriority')
if honeypot:
raise PermissionDenied
# save the user
new_user = form.save()
if not new_user.is_active:
if settings.ACCOUNTS_APPROVAL_REQUIRED:
send_approve_mail(request, new_user)
info(request, _("Thanks for signing up! You'll receive "
"an email when your account is activated."))
else:
send_verification_mail(request, new_user, "signup_verify")
info(request, _("A verification email has been sent with "
"a link for activating your account."))
return redirect(next_url(request) or "/")
else:
info(request, _("Successfully signed up"))
auth_login(request, new_user)
return login_redirect(request)
context = {"form": form, "title": _("Sign up")}
return render(request, template, context)
开发者ID:Osmose,项目名称:fxoss,代码行数:33,代码来源:views.py
示例6: password_reset
def password_reset(request, template="accounts/account_password_reset.html"):
form = PasswordResetForm(request.POST or None)
if request.method == "POST" and form.is_valid():
user = form.save()
send_verification_mail(request, user, "password_reset_verify")
info(request, _("A verification email has been sent with " "a link for resetting your password."))
context = {"form": form, "title": _("Password Reset")}
return render(request, template, context)
开发者ID:niotech,项目名称:mezzanine,代码行数:8,代码来源:views.py
示例7: password_reset
def password_reset(request, template="accounts/account_password_reset.html",
form_class=PasswordResetForm, extra_context=None):
form = form_class(request.POST or None)
if request.method == "POST" and form.is_valid():
user = form.save()
send_verification_mail(request, user, "password_reset_verify")
info(request, _("A verification email has been sent with "
"a link for resetting your password."))
context = {"form": form, "title": _("Password Reset")}
context.update(extra_context or {})
return TemplateResponse(request, template, context)
开发者ID:Anlim,项目名称:mezzanine,代码行数:11,代码来源:views.py
示例8: signup
def signup(request, template="accounts/account_signup.html", extra_context=None):
"""
Signup form. Overriding mezzanine's view function for signup submit
"""
form = SignupForm(request, request.POST, request.FILES)
if request.method == "POST" and form.is_valid():
try:
new_user = form.save()
except ValidationError as e:
if e.message == "Email already in use.":
messages.error(request, '<p>An account with this email already exists. Log in '
'or click <a href="' + reverse("mezzanine_password_reset") +
'" >here</a> to reset password',
extra_tags="html")
else:
messages.error(request, e.message)
return HttpResponseRedirect(request.META['HTTP_REFERER'])
else:
if not new_user.is_active:
if settings.ACCOUNTS_APPROVAL_REQUIRED:
send_approve_mail(request, new_user)
info(request, _("Thanks for signing up! You'll receive "
"an email when your account is activated."))
else:
send_verification_mail(request, new_user, "signup_verify")
info(request, _("A verification email has been sent to " + new_user.email +
" with a link that must be clicked prior to your account "
"being activated. If you do not receive this email please "
"check that you entered your address correctly, or your "
"spam folder as sometimes the email gets flagged as spam. "
"If you entered an incorrect email address, please request "
"an account again."))
return redirect(next_url(request) or "/")
else:
info(request, _("Successfully signed up"))
auth_login(request, new_user)
return login_redirect(request)
# remove the key 'response' from errors as the user would have no idea what it means
form.errors.pop('response', None)
messages.error(request, form.errors)
# TODO: User entered data could be retained only if the following
# render function would work without messing up the css
# context = {
# "form": form,
# "title": _("Sign up"),
# }
# context.update(extra_context or {})
# return render(request, template, context)
# This one keeps the css but not able to retained user entered data.
return HttpResponseRedirect(request.META['HTTP_REFERER'])
开发者ID:hydroshare,项目名称:hydroshare,代码行数:54,代码来源:views.py
示例9: resend_verification_email
def resend_verification_email(request, email):
user = User.objects.filter(email=email).first()
if user is None:
user = User.objects.filter(username=email).first()
if user is None:
messages.error(request, _("Could not find user or email " + email))
return redirect(reverse("login"))
if user.is_active :
messages.error(request, _("User with email " + user.email + " is already active"))
return redirect(reverse("login"))
send_verification_mail(request, user, "signup_verify")
messages.error(request, _("Resent verification email to " + user.email))
return redirect(request.META['HTTP_REFERER'])
开发者ID:hydroshare,项目名称:hydroshare,代码行数:13,代码来源:views.py
示例10: signup
def signup(request, template="accounts/account_signup.html"):
"""
Signup form.
"""
profile_form = UserRegistrationLeadForm
form = profile_form(request.POST or None, request.FILES or None)
if request.method == "POST" and form.is_valid():
data = form.cleaned_data.copy()
# ensure user is not a robot
honeypot = data.pop('superpriority')
if honeypot:
raise PermissionDenied
# save the user
new_user = form.save()
# Generate Salesforce Lead
# Pop non-Salesforce Fields
for field in ['password1', 'password2']:
data.pop(field)
for k, v in SALESFORCE_FIELD_MAPPINGS.items():
data[v] = data.pop(k)
data['oid'] = '00DU0000000IrgO'
# As we're doing the Salesforce POST in the background here,
# `retURL` is never visited/seen by the user. I believe it
# is required by Salesforce though, so it should hang around
# as a placeholder (with a valid URL, just in case).
data['retURL'] = (request.build_absolute_uri())
r = requests.post('https://www.salesforce.com/servlet/'
'servlet.WebToLead?encoding=UTF-8', data)
if not new_user.is_active:
if settings.ACCOUNTS_APPROVAL_REQUIRED:
send_approve_mail(request, new_user)
info(request, _("Thanks for signing up! You'll receive "
"an email when your account is activated."))
else:
send_verification_mail(request, new_user, "signup_verify")
info(request, _("A verification email has been sent with "
"a link for activating your account."))
return redirect(next_url(request) or "/")
else:
info(request, _("Successfully signed up"))
auth_login(request, new_user)
return login_redirect(request)
context = {"form": form, "title": _("Sign up")}
return render(request, template, context)
开发者ID:J0WI,项目名称:fxoss,代码行数:49,代码来源:views.py
示例11: signup
def signup(request, template="accounts/account_signup.html"):
"""
Signup form.
"""
form = ProfileForm(request.POST or None)
if request.method == "POST" and form.is_valid():
new_user = form.save()
if not new_user.is_active:
send_verification_mail(request, new_user, "signup_verify")
info(request, _("A verification email has been sent with "
"a link for activating your account."))
else:
info(request, _("Successfully signed up"))
auth_login(request, new_user)
return login_redirect(request)
context = {"form": form, "title": _("Signup")}
return render(request, template, context)
开发者ID:a5an0,项目名称:mezzanine,代码行数:17,代码来源:views.py
示例12: signup
def signup(request, template="accounts/account_signup.html"):
"""
Signup form.
"""
profile_form = get_profile_form()
form = profile_form(request.POST or None, request.FILES or None)
if request.method == "POST" and form.is_valid():
new_user = form.save()
if not new_user.is_active:
if settings.ACCOUNTS_APPROVAL_REQUIRED:
send_approve_mail(request, new_user)
info(request, _("Thanks for signing up! You'll receive "
"an email when your account is activated."))
else:
send_verification_mail(request, new_user, "signup_verify")
info(request, _("A verification email has been sent with "
"a link for activating your account."))
# return redirect(request.GET.get("next", "/"))
return redirect(next_url(request) or "/")
else:
info(request, _("Successfully signed up"))
auth_login(request, new_user)
customer = request.user.get_profile()
customer_address = customer.address + ', ' + customer.zip_code
loc = location_utils.getLocation(customer_address)
correct_address = location_utils.getAddress(loc[0],loc[1])
customer.location = loc
customer.address = correct_address
customer.save()
request.session['location'] = (loc[0],loc[1])
request.session['age'] = True
request.session['address'] = correct_address
request.session['map'] = True
avail_store_ids, avail_store_names, avail_liquor_types, loc, store_locs = new_location_get_ids(request, loc)
# return login_redirect(request)
if 'cart loaded' in request.session:
return redirect('/shop/cart/')
else:
return redirect('/shop/')
context = {"form": form, "title": _("Sign up")}
return render(request, template, context)
开发者ID:obsjames,项目名称:md-production-public,代码行数:45,代码来源:views.py
示例13: wholesale_signup
def wholesale_signup(request, template="accounts/wholesale_signup.html"):
form = ProfileForm(request.POST or None)
if request.method == "POST" and form.is_valid():
new_user = form.save()
g = Group.objects.get(name='Wholesale Customers')
g.user_set.add(new_user)
# Add to campaign monitor
if bool(form.cleaned_data.get("optin")):
cm_api = CampaignMonitorApi(settings.CM_API_KEY, settings.CM_CLIENT_ID)
listid = settings.CM_WHOLESALE_LIST_ID
usertype = ""
if form.cleaned_data.get("user_type"):
try:
usertype = USER_TYPE_CHOICES[form.cleaned_data.get("user_type")]
except:
pass
elif form.cleaned_data.get("user_type_other"):
usertype = form.cleaned_data.get("user_type_other")
custom_fields = {"CustomerType": usertype}
try:
cm_api.subscriber_add(
listid,
form.cleaned_data.get("email"),
form.cleaned_data.get("first_name") + ' ' + form.cleaned_data.get("last_name"),
custom_fields=custom_fields)
except:
pass
if not new_user.is_active:
send_verification_mail(request, new_user, "signup_verify")
info(request, "A verification email has been sent with a link for activating your account.")
else:
info(request, "Successfully signed up")
auth_login(request, new_user)
send_registration_confirmation_email(request)
return my_login_redirect(request, wholesale=True)
context = {"form": form, "title": "Wholesale Customer Registration"}
return render(request, template, context)
开发者ID:zs425,项目名称:Manai-python-,代码行数:41,代码来源:views.py
示例14: save_model
def save_model(self, request, obj, form, change):
"""
If the ``ACCOUNTS_APPROVAL_REQUIRED`` setting is ``True``,
send a notification email to the user being saved if their
``active`` status has changed to ``True``.
If the ``ACCOUNTS_VERIFICATION_REQUIRED`` setting is ``True``,
send a verification email instead.
"""
must_send_verification_mail_after_save = False
if change and settings.ACCOUNTS_APPROVAL_REQUIRED:
if obj.is_active and not User.objects.get(id=obj.id).is_active:
if settings.ACCOUNTS_VERIFICATION_REQUIRED:
# Accounts verification requires an inactive account
obj.is_active = False
# The token generated by send_verification_mail()
# must match the _saved_ User object,
# so postpone send_verification_mail() until later
must_send_verification_mail_after_save = True
else:
send_approved_mail(request, obj)
super(UserProfileAdmin, self).save_model(request, obj, form, change)
if must_send_verification_mail_after_save:
user = User.objects.get(id=obj.id)
send_verification_mail(request, user, "signup_verify")
开发者ID:Anlim,项目名称:mezzanine,代码行数:24,代码来源:admin.py
注:本文中的mezzanine.utils.email.send_verification_mail函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论