Mercurial > libervia-web
comparison src/server/server.py @ 801:68eadda8a59a
server_side: fixed confusion between jid user and host when there's not arobase
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 09 Dec 2015 11:19:41 +0100 |
parents | fad9c9f82ae3 |
children | 3905bc24eb17 |
comparison
equal
deleted
inserted
replaced
800:4caf2caa898a | 801:68eadda8a59a |
---|---|
817 except (RuntimeError, jid.InvalidFormat, AttributeError): | 817 except (RuntimeError, jid.InvalidFormat, AttributeError): |
818 request.write(C.PROFILE_AUTH_ERROR) | 818 request.write(C.PROFILE_AUTH_ERROR) |
819 request.finish() | 819 request.finish() |
820 return | 820 return |
821 | 821 |
822 # redirect "user@libervia.org" to the "user" profile | 822 # XXX: if there's no arobase in the JID, its host part is filled and the SàT profile name |
823 if login_jid.host == new_account_domain: | 823 # is there ; we need to look in the JID's user part to know if there's an arobase or not. |
824 login = login_jid.user | 824 |
825 if login_jid.user and login_jid.host == new_account_domain: | |
826 # redirect "user@libervia.org" to the "user" profile | |
827 login_jid = jid.JID(login_jid.user) | |
825 | 828 |
826 try: | 829 try: |
827 profile = self.sat_host.bridge.getProfileName(login) | 830 profile = self.sat_host.bridge.getProfileName(login_jid.full()) |
828 except Exception: # XXX: ProfileUnknownError wouldn't work, it's encapsulated | 831 except Exception: # XXX: ProfileUnknownError wouldn't work, it's encapsulated |
829 # try to create a new sat profile using the XMPP credentials | 832 if login_jid.user: # try to create a new sat profile using the XMPP credentials |
830 profile = login | 833 profile = login_jid.full() |
831 connect_method = "asyncConnectWithXMPPCredentials" | 834 connect_method = "asyncConnectWithXMPPCredentials" |
832 register_with_ext_jid = True | 835 register_with_ext_jid = True |
836 else: # non existing username | |
837 request.write(C.PROFILE_AUTH_ERROR) | |
838 request.finish() | |
839 return | |
833 else: | 840 else: |
834 if profile != login or (not password and profile not in self.sat_host.empty_password_allowed_warning_dangerous_list): | 841 if profile != login_jid.full() or (not password and profile not in self.sat_host.empty_password_allowed_warning_dangerous_list): |
835 # profiles with empty passwords are restricted to local frontends | 842 # profiles with empty passwords are restricted to local frontends |
836 request.write(C.PROFILE_AUTH_ERROR) | 843 request.write(C.PROFILE_AUTH_ERROR) |
837 request.finish() | 844 request.finish() |
838 return | 845 return |
839 register_with_ext_jid = False | 846 register_with_ext_jid = False |