Updates (#134)
* 🐛 User not added to DB - force die() on error (#118) * 🐛 User not added to DB - force die() on error Signed-off-by: Luke Tainton <luke@tainton.uk> * Restyled by php-cs-fixer (#119) Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com> Co-authored-by: Restyled.io <commits@restyled.io> * Fixing Login Die * Broken login (#121) * Fixing Login Die * Fix Broken Login 2 * Broken login (#122) * Fixing Login Die * Fix Broken Login 2 * Update footer * Try Somethin New Today * Move break rule in footer (#124) * Update footer.php * Change line break to pipe * Remove full stop Co-authored-by: Alexander Davis <alex@adcm.uk> * ✨ Add Sentry (#127) Signed-off-by: Luke Tainton <luke@tainton.uk> * 🚧 Migrate from Sentry to GlitchTip (#129) Signed-off-by: Luke Tainton <luke@tainton.uk> * 🐛 Move opening and closing 'main' tags (#132) * 🐛 Move opening and closing 'main' tags Signed-off-by: Luke Tainton <luke@tainton.uk> * Restyled by php-cs-fixer (#133) Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com> Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Luke Tainton <luke@tainton.uk> Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com> Co-authored-by: Restyled.io <commits@restyled.io>
This commit was merged in pull request #134.
This commit is contained in:
@@ -6,6 +6,44 @@
|
||||
return $version;
|
||||
}
|
||||
|
||||
function oidc_set_vars($sub, $uid, $fname, $lname, $email)
|
||||
{
|
||||
$_SESSION['uuid'] = $sub;
|
||||
$_SESSION['username'] = $uid;
|
||||
$_SESSION['given_name'] = $fname;
|
||||
$_SESSION['family_name'] = $lname;
|
||||
$_SESSION['full_name'] = $fname . " " . $lname;
|
||||
$_SESSION['email'] = $email;
|
||||
}
|
||||
|
||||
function is_signed_in()
|
||||
{
|
||||
if (isset($_SESSION['is_signed_in'])) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function user_exists($db, $uuid)
|
||||
{
|
||||
try {
|
||||
$sql = $db->prepare("SELECT uuid FROM users WHERE uuid=:uuid");
|
||||
$sql->bindParam(':uuid', $uuid);
|
||||
$sql->execute();
|
||||
$sql->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$result = $sql->fetchAll();
|
||||
} catch (PDOException $e) {
|
||||
throw new Exception("Error in user_exists(): " . $e->getMessage());
|
||||
die();
|
||||
}
|
||||
if (empty($result)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function get_all_users($db)
|
||||
{
|
||||
try {
|
||||
@@ -15,7 +53,8 @@
|
||||
$sql->setFetchMode(PDO::FETCH_ASSOC);
|
||||
$result = $sql->fetchAll();
|
||||
} catch (PDOException $e) {
|
||||
echo("Error: " . $e->getMessage());
|
||||
throw new Exception("Error in get_all_users(): " . $e->getMessage());
|
||||
die();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@@ -31,7 +70,8 @@
|
||||
$result = $sql->fetchAll();
|
||||
$usr = $result[0]['given_name'] . " " . $result[0]['family_name'];
|
||||
} catch (PDOException $e) {
|
||||
echo("Error: " . $e->getMessage());
|
||||
throw new Exception("Error in get_user_name(): " . $e->getMessage());
|
||||
die();
|
||||
}
|
||||
return $usr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user