mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-19 20:09:14 +03:00
Merge pull request #183 from tuxis-ie/nice-authdb-error
Show a clear message instead of ERROR 500
This commit is contained in:
commit
c63dbba617
1 changed files with 12 additions and 7 deletions
|
@ -59,6 +59,7 @@ if (function_exists('openssl_random_pseudo_bytes') === FALSE) {
|
||||||
|
|
||||||
$defaults['defaulttype'] = ucfirst(strtolower($defaults['defaulttype']));
|
$defaults['defaulttype'] = ucfirst(strtolower($defaults['defaulttype']));
|
||||||
|
|
||||||
|
try {
|
||||||
if (isset($authdb) && !file_exists($authdb) && class_exists('SQLite3')) {
|
if (isset($authdb) && !file_exists($authdb) && class_exists('SQLite3')) {
|
||||||
is_dir(dirname($authdb)) || mkdir(dirname($authdb));
|
is_dir(dirname($authdb)) || mkdir(dirname($authdb));
|
||||||
$db = new SQLite3($authdb, SQLITE3_OPEN_CREATE|SQLITE3_OPEN_READWRITE);
|
$db = new SQLite3($authdb, SQLITE3_OPEN_CREATE|SQLITE3_OPEN_READWRITE);
|
||||||
|
@ -67,6 +68,10 @@ if (isset($authdb) && !file_exists($authdb) && class_exists('SQLite3')) {
|
||||||
$salt = bin2hex(openssl_random_pseudo_bytes(16));
|
$salt = bin2hex(openssl_random_pseudo_bytes(16));
|
||||||
$db->exec("INSERT INTO users (emailaddress, password, isadmin) VALUES ('admin', '".crypt("admin", '$6$'.$salt)."', 1)");
|
$db->exec("INSERT INTO users (emailaddress, password, isadmin) VALUES ('admin', '".crypt("admin", '$6$'.$salt)."', 1)");
|
||||||
}
|
}
|
||||||
|
} catch (Exception $e) {
|
||||||
|
print("We have issues getting the authdb working: $e");
|
||||||
|
$blocklogin = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
function string_starts_with($string, $prefix)
|
function string_starts_with($string, $prefix)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue