diff options
author | Philipp Hörist <philipp@hoerist.com> | 2023-11-06 12:51:30 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2023-11-06 12:51:39 +0300 |
commit | 82c2d725b2474d2e4e8a892df327376a390d7065 (patch) | |
tree | 045f8ea13b2accf36fa4c77b4e8e92f9b94162b8 | |
parent | 60c44b23e769dab115e6be1740af00b43b5323d9 (diff) |
fix: AccountWizard: Don’t allow multiple anonymous accounts for the same domain
-rw-r--r-- | gajim/gtk/account_wizard.py | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/gajim/gtk/account_wizard.py b/gajim/gtk/account_wizard.py index be85cc756..41dc9a9f9 100644 --- a/gajim/gtk/account_wizard.py +++ b/gajim/gtk/account_wizard.py @@ -182,6 +182,17 @@ class AccountWizard(Assistant): self._test_credentials(ignore_all_errors=True) elif button_name == 'signup': + + if self.get_page('signup').is_anonymous(): + domain = self.get_page('signup').get_server() + + if app.settings.account_exists(f'anon@{domain}'): + self._show_error_page( + _('Account exists already'), + _('Account exists already'), + _('This account has already been added')) + return + if page == 'signup': if self.get_page('signup').is_advanced(): self.show_page('advanced', @@ -675,15 +686,12 @@ class Login(Page): Gtk.EntryIconPosition.SECONDARY, _('Invalid Address')) return False - for account in app.settings.get_accounts(): - name = app.settings.get_account_setting(account, 'name') - hostname = app.settings.get_account_setting(account, 'hostname') - if address == f'{name}@{hostname}': - self._show_icon(True) - self._ui.log_in_address_entry.set_icon_tooltip_text( - Gtk.EntryIconPosition.SECONDARY, - _('This account has already been added')) - return False + if app.settings.account_exists(address): + self._show_icon(True) + self._ui.log_in_address_entry.set_icon_tooltip_text( + Gtk.EntryIconPosition.SECONDARY, + _('This account has already been added')) + return False self._show_icon(False) return True |