Esempio n. 1
0
    def handle_valid(self, form, user):
        domain = form.cleaned_data['domain']
        payload = self.handle_gpg(form, user)
        payload['email'] = form.cleaned_data['email']

        if settings.XMPP_HOSTS[domain].get('RESERVE', False):
            backend.reserve(
                username=form.cleaned_data['username'], domain=domain, email=user.email)
        return payload
Esempio n. 2
0
    def save_model(self, request, obj, form, change):
        site = settings.XMPP_HOSTS[obj.domain]

        obj.save()
        if change is True:  # changed user
            from_db = User.objects.only('email').get(jid=obj.jid)
            if from_db.email != form.cleaned_data['email']:
                payload = {
                    'gpg_fingerprint': form.cleaned_data.get('gpg_fingerprint'),
                    'email': form.cleaned_data['email'],
                }
                self._confirm(request, obj, purpose=PURPOSE_REGISTER, payload=payload)
        else: # new user
            if site.get('RESERVE', False):
                backend.reserve(username=obj.username, domain=obj.domain, email=obj.email)
            if obj.email:
                self._confirm(request, obj, purpose=PURPOSE_REGISTER)
Esempio n. 3
0
    def save_model(self, request, obj, form, change):
        site = settings.XMPP_HOSTS[obj.domain]

        obj.save()
        if change is True:  # changed user
            from_db = User.objects.only('email').get(jid=obj.jid)
            if from_db.email != form.cleaned_data['email']:
                payload = {
                    'gpg_fingerprint':
                    form.cleaned_data.get('gpg_fingerprint'),
                    'email': form.cleaned_data['email'],
                }
                self._confirm(request,
                              obj,
                              purpose=PURPOSE_REGISTER,
                              payload=payload)
        else:  # new user
            if site.get('RESERVE', False):
                backend.reserve(username=obj.username,
                                domain=obj.domain,
                                email=obj.email)
            if obj.email:
                self._confirm(request, obj, purpose=PURPOSE_REGISTER)
Esempio n. 4
0
 def handle_valid(self, form, user):
     if settings.XMPP_HOSTS[user.domain].get('RESERVE', False):
         backend.reserve(username=user.username, domain=user.domain,
                         email=user.email)