Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4380 Widoki

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
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
0
sie 24
3786
4
lut 23
6887
0
cze 20
2446
1
paź 19
11155
0
paź 23
4012