def resend_confirmation(request): try: dom_req = RegistrationRequest.get_request_for_username( request.user.username) except Exception: dom_req = None if not dom_req: inactive_domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(inactive_domains_for_user) > 0: for domain in inactive_domains_for_user: domain.is_active = True domain.save() return redirect('domain_select') context = get_domain_context() if request.method == 'POST': try: send_domain_registration_email(dom_req.new_user_username, dom_req.domain, dom_req.activation_guid, request.user.get_full_name(), request.user.first_name) except Exception: context.update({ 'current_page': { 'page_name': _('Oops!') }, 'error_msg': _('There was a problem with your request'), 'error_details': sys.exc_info(), 'show_homepage_link': 1, }) return render(request, 'error.html', context) else: context.update({ 'requested_domain': dom_req.domain, 'current_page': { 'page_name': ('Confirmation Email Sent') }, }) return render(request, 'registration/confirmation_sent.html', context) context.update({ 'requested_domain': dom_req.domain, 'current_page': { 'page_name': _('Resend Confirmation Email') }, }) return render(request, 'registration/confirmation_resend.html', context)
def resend_confirmation(request): try: dom_req = RegistrationRequest.get_request_for_username(request.user.username) except Exception: dom_req = None if not dom_req: inactive_domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(inactive_domains_for_user) > 0: for domain in inactive_domains_for_user: domain.is_active = True domain.save() return redirect('domain_select') context = get_domain_context() default_page_name = _('Resend Confirmation Email') if request.method == 'POST': if (datetime.utcnow() - dom_req.request_time).seconds < CONFIRMATION_RESEND_LIMIT_SECONDS: context = { 'message_body': _(f'Please wait at least {CONFIRMATION_RESEND_LIMIT_SECONDS} ' f'seconds before requesting again.'), 'current_page': {'page_name': default_page_name}, } return render(request, 'registration/confirmation_error.html', context) try: dom_req.request_time = datetime.utcnow() dom_req.request_ip = get_ip(request) dom_req.save() send_domain_registration_email(dom_req.new_user_username, dom_req.domain, dom_req.activation_guid, request.user.get_full_name(), request.user.first_name) except Exception: context.update({ 'current_page': {'page_name': _('Oops!')}, 'error_msg': _('There was a problem with your request'), 'show_homepage_link': 1, }) return render(request, 'error.html', context) else: context.update({ 'requested_domain': dom_req.domain, 'current_page': {'page_name': _('Confirmation Email Sent')}, }) return render(request, 'registration/confirmation_sent.html', context) context.update({ 'requested_domain': dom_req.domain, 'current_page': {'page_name': default_page_name}, }) return render(request, 'registration/confirmation_resend.html', context)
def resend_confirmation(request): try: dom_req = RegistrationRequest.get_request_for_username( request.user.username) except Exception: dom_req = None if not dom_req: inactive_domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(inactive_domains_for_user) > 0: for domain in inactive_domains_for_user: domain.is_active = True domain.save() return redirect('domain_select') context = get_domain_context(dom_req.project.domain_type) if request.method == 'POST': try: send_domain_registration_email(dom_req.new_user_username, dom_req.domain, dom_req.activation_guid) except Exception: context.update({ 'error_msg': _('There was a problem with your request'), 'error_details': sys.exc_info(), 'show_homepage_link': 1, }) return render(request, 'error.html', context) else: context.update({ 'alert_message': _("An email has been sent to %s.") % dom_req.new_user_username, 'requested_domain': dom_req.domain }) return render(request, 'registration/confirmation_sent.html', context) context.update({'requested_domain': dom_req.domain}) return render(request, 'registration/confirmation_resend.html', context)
def resend_confirmation(request): try: dom_req = RegistrationRequest.get_request_for_username(request.user.username) except Exception: dom_req = None if not dom_req: inactive_domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(inactive_domains_for_user) > 0: for domain in inactive_domains_for_user: domain.is_active = True domain.save() return redirect('domain_select') context = get_domain_context() if request.method == 'POST': try: send_domain_registration_email(dom_req.new_user_username, dom_req.domain, dom_req.activation_guid, request.user.get_full_name(), request.user.first_name) except Exception: context.update({ 'current_page': {'page_name': _('Oops!')}, 'error_msg': _('There was a problem with your request'), 'error_details': sys.exc_info(), 'show_homepage_link': 1, }) return render(request, 'error.html', context) else: context.update({ 'requested_domain': dom_req.domain, 'current_page': {'page_name': ('Confirmation Email Sent')}, }) return render(request, 'registration/confirmation_sent.html', context) context.update({ 'requested_domain': dom_req.domain, 'current_page': {'page_name': _('Resend Confirmation Email')}, }) return render(request, 'registration/confirmation_resend.html', context)
def resend_confirmation(request): try: dom_req = RegistrationRequest.get_request_for_username(request.user.username) except Exception: dom_req = None if not dom_req: inactive_domains_for_user = Domain.active_for_user(request.user, is_active=False) if len(inactive_domains_for_user) > 0: for domain in inactive_domains_for_user: domain.is_active = True domain.save() return redirect('domain_select') context = get_domain_context(dom_req.project.domain_type) if request.method == 'POST': try: send_domain_registration_email(dom_req.new_user_username, dom_req.domain, dom_req.activation_guid, request.user.get_full_name()) except Exception: context.update({ 'error_msg': _('There was a problem with your request'), 'error_details': sys.exc_info(), 'show_homepage_link': 1, }) return render(request, 'error.html', context) else: context.update({ 'alert_message': _( "An email has been sent to %s.") % dom_req.new_user_username, 'requested_domain': dom_req.domain }) return render(request, 'registration/confirmation_sent.html', context) context.update({ 'requested_domain': dom_req.domain }) return render(request, 'registration/confirmation_resend.html', context)