diff options
-rw-r--r-- | ogcp/views.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index f023d1f..59e138c 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -2903,12 +2903,18 @@ def save_user(form, preserve_pwd): with open(filename, 'r+') as file: config = json.load(file) + old_user = get_user(username) + + if old_user: + config['USERS'].remove(old_user) config['USERS'].append(user) file.seek(0) json.dump(config, file, indent='\t') file.truncate() + if old_user: + app.config['USERS'].remove(old_user) app.config['USERS'].append(user) return redirect(url_for('users')) @@ -2998,8 +3004,6 @@ def user_edit_post(): if preserve_pwd: form.pwd.data = old_user_data.get("PASS") - delete_user(username) - return save_user(form, preserve_pwd) |