Restyle 🐛 User not added to DB - force die() on error #119

Merged
restyled-io[bot] merged 1 commits from restyled/bug-69 into bug-69 2020-08-17 14:46:50 +00:00
2 changed files with 41 additions and 44 deletions
Showing only changes of commit 7d38a80071 - Show all commits

View File

@@ -15,8 +15,7 @@
} catch (PDOException $e) { } catch (PDOException $e) {
$alert = array("danger", "Error during check for user record: " . $e->getMessage()); $alert = array("danger", "Error during check for user record: " . $e->getMessage());
} }
if (empty($sql)) if (empty($sql)) {
{
return false; return false;
} else { } else {
return true; return true;

View File

@@ -17,8 +17,7 @@
$alert = array("danger", "Error during OpenID Connect authentication: " . $e->getMessage()); $alert = array("danger", "Error during OpenID Connect authentication: " . $e->getMessage());
} }
if (!user_exists($db, $uuid)) if (!user_exists($db, $uuid)) {
{
// User doesn't already exist // User doesn't already exist
try { try {
$stmt = "INSERT INTO users (uuid, uid, given_name, family_name, email) VALUES (:sub, :username, :given, :family, :email)"; $stmt = "INSERT INTO users (uuid, uid, given_name, family_name, email) VALUES (:sub, :username, :given, :family, :email)";
@@ -58,4 +57,3 @@
$_SESSION['is_signed_in'] = "true"; $_SESSION['is_signed_in'] = "true";
header('Location: /'); header('Location: /');
?>