From 32435b116ff6a51f89e0582cf34e0d87a43533cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Nov=C3=BD?= <github-lnovy@krtek.net> Date: Tue, 30 Jun 2015 08:33:20 +0000 Subject: [PATCH] Fix create_user function in auth_systems.password --- helios_auth/auth_systems/password.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/helios_auth/auth_systems/password.py b/helios_auth/auth_systems/password.py index e39573e..57c2138 100644 --- a/helios_auth/auth_systems/password.py +++ b/helios_auth/auth_systems/password.py @@ -16,11 +16,14 @@ STATUS_UPDATES = False def create_user(username, password, name = None): from helios_auth.models import User - - user = User.get_by_type_and_id('password', username) - if user: + from django.db import models + + try: + user = User.get_by_type_and_id('password', username) raise Exception('user exists') - + except User.DoesNotExist: + pass + info = {'password' : password, 'name': name} user = User.update_or_create(user_type='password', user_id=username, info = info) user.save() -- GitLab