From: Michael Tremer Date: Fri, 25 Oct 2019 16:00:36 +0000 (+0100) Subject: accounts: Do not fail when an account has already been created X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd5c84529ee3c52aebce0974b061c739d8dae477;p=ipfire.org.git accounts: Do not fail when an account has already been created When people choose a password that is too weak, the account might already have been created and a second attempt will fail. This prevents that. Signed-off-by: Michael Tremer --- diff --git a/src/backend/accounts.py b/src/backend/accounts.py index 9d72b1cb..d36dbafb 100644 --- a/src/backend/accounts.py +++ b/src/backend/accounts.py @@ -218,6 +218,11 @@ class Accounts(Object): if not res: return + # Return the account if it has already been created + account = self.get_by_uid(uid) + if account: + return account + # Create a new account on the LDAP database account = self.create(uid, res.email, first_name=res.first_name, last_name=res.last_name,