From b7ffbd0bfd798bfa872cd189ee16b133bb1bf447 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 16 Jul 2013 16:02:52 +0200 Subject: [PATCH] fixing issue for first created admin user --- public/include/classes/user.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/include/classes/user.class.php b/public/include/classes/user.class.php index 9d448a40..4f9f5cd4 100644 --- a/public/include/classes/user.class.php +++ b/public/include/classes/user.class.php @@ -497,11 +497,14 @@ class User { } if ($this->mysqli->query("SELECT id FROM $this->table LIMIT 1")->num_rows > 0) { $this->config['accounts']['confirm_email']['enabled'] ? $is_locked = 1 : $is_locked = 0; + $is_admin = 0; $stmt = $this->mysqli->prepare(" INSERT INTO $this->table (username, pass, email, pin, api_key, is_locked) VALUES (?, ?, ?, ?, ?, ?) "); } else { + $is_locked = 0; + $is_admin = 1; $stmt = $this->mysqli->prepare(" INSERT INTO $this->table (username, pass, email, pin, api_key, is_admin, is_locked) VALUES (?, ?, ?, ?, ?, 1, ?) @@ -515,7 +518,7 @@ class User { $username_clean = strip_tags($username); if ($this->checkStmt($stmt) && $stmt->bind_param('sssssi', $username_clean, $password_hash, $email1, $pin_hash, $apikey_hash, $is_locked) && $stmt->execute()) { - if ($this->config['accounts']['confirm_email']['enabled']) { + if ($this->config['accounts']['confirm_email']['enabled'] && $is_admin != 1) { if ($token = $this->token->createToken('confirm_email', $stmt->insert_id)) { $aData['username'] = $username_clean; $aData['token'] = $token;