Skip to content
Extraits de code Groupes Projets
main.py 1,03 ko
Newer Older
  • Learn to ignore specific revisions
  • Hugo Trentesaux's avatar
    Hugo Trentesaux a validé
    from odoo import http, tools, _
    from odoo.addons.auth_signup.controllers.main import AuthSignupHome
    
    
    class SolagroAuthSignupHome(AuthSignupHome):
        @http.route('/web/signup', type='http', auth='public', website=True, sitemap=False)
        def web_auth_signup(self, **post):
            # email validation
            if post and http.request.httprequest.method == 'POST':
                email = post.get('email')
                if email and not tools.single_email_re.match(email):
                    post.update({'error': _('Invalid Email! Please enter a valid email address.'), 'error_email': True})
                else:
                    post["login"] = email
            # name from firstname / lastname
            if post and http.request.httprequest.method == 'POST':
                firstname = post.get('firstname')
                lastname = post.get('lastname')
                post["name"] = firstname + " " + lastname
    
            # update request params because super() uses this instead of kwargs
    
    Hugo Trentesaux's avatar
    Hugo Trentesaux a validé
            http.request.params.update(post)
    
            return super().web_auth_signup(**post)