Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
4354 Weergaven

When I create new account from website, I need to click Click here to send verification email allowing you participate at the elearning in elearning courses.I don't want to click this and want to automatically send verification email .How can I solve that? I try to add in sign up function but not work. Here is my code for sign up

@http.route('/web/signup', type='http', auth='public', website=True, sitemap=False)
    def web_auth_signup(self, *args, **kw):
        qcontext = self.get_auth_signup_qcontext()
        qcontext['countries'] = request.env['res.country'].sudo().search([])

        if not qcontext.get('token') and not qcontext.get('signup_enabled'):
            raise werkzeug.exceptions.NotFound()

        if 'error' not in qcontext and request.httprequest.method == 'POST':
            try:
                self.do_signup(qcontext)
                # Send an account creation confirmation email
                if qcontext.get('token'):
                    user_sudo = request.env['res.users'].sudo().search([('login', '=', qcontext.get('login'))])
                    template = request.env.ref('auth_signup.mail_template_user_signup_account_created',
                                               raise_if_not_found=False)
                    if user_sudo and template:
                        template.sudo().with_context(
                            lang=user_sudo.lang,
                            auth_login=werkzeug.url_encode({'auth_login': user_sudo.email}),
                        ).send_mail(user_sudo.id, force_send=True)
                return self.web_login(*args, **kw)
            except UserError as e:
                qcontext['error'] = e.name or e.value
            except (SignupError, AssertionError) as e:
                if request.env["res.users"].sudo().search([("login", "=", qcontext.get("login"))]):
                    qcontext["error"] = _("Another user is already registered using this email address.")
                else:
                    _logger.error("%s", e)
                    qcontext['error'] = _("Could not create a new account.")

        response = request.render('auth_signup.signup', qcontext)
        response.headers['X-Frame-Options'] = 'DENY'
        if request.env.uid != request.website.user_id.id:
            logging.info("Sending Email+++++++++++++++++++++++++++++++")
            request.env.user._send_profile_validation_email(**kwargs)
        logging.info(request.env.user.name)
        logging.info("user name+++++++++++++++++++++")
        request.session['validation_email_sent'] = True

        return response
Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
aug. 24
3748
4
feb. 23
6856
0
jun. 20
2418
1
okt. 19
11122
0
okt. 23
3989