Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
4566 Visualizzazioni

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
ago 24
3903
4
feb 23
7045
0
giu 20
2571
1
ott 19
11348
0
ott 23
4118