]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
fix eventual bugs when user exists in database and connection doesn't work
authorThomas Citharel <tcit@tcit.fr>
Sun, 1 Mar 2015 20:56:01 +0000 (21:56 +0100)
committerThomas Citharel <tcit@tcit.fr>
Sun, 1 Mar 2015 20:56:01 +0000 (21:56 +0100)
install/index.php

index d514eb2a41216a8806bc6cdc6210784523a82d46..24577aaaf1bc0244f965fa16f832315b1847bda2 100755 (executable)
@@ -127,6 +127,13 @@ else if (isset($_POST['install'])) {
             }
             // create database structure
             $query = $handle->exec($sql_structure);
+
+            $usertest = executeQuery($handle,"SELECT * from users WHERE username = ?", array($username));
+            if (!empty($usertest)) {
+                $continue = false;
+                $errors[] = "An user already exists with this username in database.";
+            }
+
         } catch (PDOException $e) {
             $errors[] = $e->getMessage();
             $continue = false;
@@ -134,13 +141,6 @@ else if (isset($_POST['install'])) {
         }
     }
 
-    $usertest = executeQuery($handle,"SELECT * from users WHERE username = ?", array($username));
-    if (!empty($usertest)) {
-        $continue = false;
-        $errors[] = "An user already exists with this username in database.";
-    }
-
-
     if ($continue) {
         $sql = "INSERT INTO users (username, password, name, email) VALUES (?, ?, ?, ?)";
         $params = array($username, $salted_password, $username, $email);