def autoRegister(self, client): registry = getUtility(IRegistry) settings = registry.forInterface(IXMPPSettings, check=False) if not settings.auto_register_on_login or client._state == 'connecting': return setup.registerXMPPUsers(getSite(), [self.user_id]) self.bind_retry = True
def autoRegister(self, client): registry = getUtility(IRegistry) settings = registry.forInterface(IXMPPSettings, check=False) if not settings.auto_register_on_login or \ client._state == 'connecting': return setup.registerXMPPUsers(getSite(), [self.user_id]) self.bind_retry = True
def registerAll(self): status = IStatusMessage(self.request) member_ids = users.getAllMemberIds() try: setup.registerXMPPUsers(self.context, member_ids) except AdminClientNotConnected: status.add( _(u"We are not yet connected to the XMPP " u"server. Either your settings are incorrect, or " u"you're trying to register users immediately after the " u"ZServer has been restarted. If your settings are correct, " u"then try again, it should work now. "), "warn") return status.add( _(u"All users are being registered in the background. " "This might take a few minutes and your site might become " "unresponsive."), "info")
def registerAll(self): status = IStatusMessage(self.request) member_ids = users.getAllMemberIds() try: setup.registerXMPPUsers(self.context, member_ids) except AdminClientNotConnected: status.add( _(u"We are not yet connected to the XMPP " u"server. Either your settings are incorrect, or " u"you're trying to register users immediately after the " u"ZServer has been restarted. If your settings are correct, " u"then try again, it should work now. "), "warn") return status.add(_( u"All users are being registered in the background. " "This might take a few minutes and your site might become " "unresponsive."), "info")
def _addAndRegisterMembers(self, member_ids): portal = self.layer['portal'] for mid in member_ids: self.mtool.addMember(mid, 'secret', ['Member'], []) # XXX: We have to do this separately, because the returned deferred is # only for the firt user (i.e we have no way of knowing when the # subsequent users have been registered. d = setup.registerXMPPUsers(portal, [mid]) wait_on_client_deferreds(self.client)
def registerSelected(self): status = IStatusMessage(self.request) widget = self.widgets.get('users') if widget.extract() == NO_VALUE: status.add(_(u"You first need to choose the users to register"), "error") return try: setup.registerXMPPUsers(self.context, self.getChosenMembers()) except AdminClientNotConnected: status.add( _(u"We are not yet connected to the XMPP " u"server. Either your settings are incorrect, or " u"you're trying to register users immediately after the " u"ZServer has been restarted. If your settings are correct, " u"then try again, it should work now. "), "warn") return return status.add(_(u"The selected users are being registered " u"in the background."), "info")
def registerSelected(self): status = IStatusMessage(self.request) widget = self.widgets.get('users') if widget.extract() == NO_VALUE: status.add(_(u"You first need to choose the users to register"), "error") return try: setup.registerXMPPUsers(self.context, self.getChosenMembers()) except AdminClientNotConnected: status.add( _(u"We are not yet connected to the XMPP " u"server. Either your settings are incorrect, or " u"you're trying to register users immediately after the " u"ZServer has been restarted. If your settings are correct, " u"then try again, it should work now. "), "warn") return return status.add( _(u"The selected users are being registered " u"in the background."), "info")