From 44b92e58b5111ef84eeb189887fc9fe0b1e28f40 Mon Sep 17 00:00:00 2001 From: Joachim Lusiardi Date: Wed, 3 Aug 2016 08:13:39 +0200 Subject: [PATCH] use config variable to identify admin account while it is created --- app/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/__init__.py b/app/__init__.py index fd530ca..c908e2f 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -58,6 +58,10 @@ def user_registered_sighandler(app, user, confirm_token): """ role = user_datastore.find_role('user') user_datastore.add_role_to_user(user, role) + if user.email == app.config['ADMIN_MAIL']: + # if the user selected the preconfigured email for the admin account + role = user_datastore.find_role('admin') + user_datastore.add_role_to_user(user, role) new_vehicle = Vehicle('default vehicle') db.session.add(new_vehicle) user.vehicles.append(new_vehicle)