code: def register_user(self, user, allow_login=None, send_email=None,
                        _force_login_without_confirmation=False):
          
          should_login_user = (not self.security.confirmable
                               or self.security.login_without_confirmation
                               or _force_login_without_confirmation)
          should_login_user = (should_login_user if allow_login is None
                               else allow_login and should_login_user)
          if should_login_user:
              user.active = True
  
          # confirmation token depends on having user.id set, which requires
          # the user be committed to the database
          self.user_manager.save(user, commit=True)
  
          confirmation_link, token = None, None
          if self.security.confirmable and not _force_login_without_confirmation:
              token = self.security_utils_service.generate_confirmation_token(user)
              confirmation_link = url_for('security_controller.confirm_email',
                                          token=token, _external=True)
  
          user_registered.send(app._get_current_object(),
                               user=user, confirm_token=token)
  
          if (send_email or (
                  send_email is None
                  and app.config.SECURITY_SEND_REGISTER_EMAIL)):
              self.send_mail(_('flask_unchained.bundles.security:email_subject.register'),
                             to=user.email,
                             template='security/email/welcome.html',
                             user=user,
                             confirmation_link=confirmation_link)
  
          if should_login_user:
              return self.login_user(user, force=_force_login_without_confirmation)
          return False
docs: Service method to register a user.
  
          Sends signal `user_registered`.
  
          Returns True if the user has been logged in, False otherwise.