mirror of https://github.com/byecorps/id.git
yo waht's up
This commit is contained in:
parent
c6a1637dee
commit
d7a64844c4
|
@ -1,2 +1,3 @@
|
|||
config.php
|
||||
vendor/
|
||||
vendor/
|
||||
.idea/
|
|
@ -1,5 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
|
@ -1,5 +0,0 @@
|
|||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
||||
</state>
|
||||
</component>
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="dataSourceStorageLocal" created-in="PS-233.13135.108">
|
||||
<data-source name="ByeCorps ID (local)" uuid="5bc27beb-c8ab-420d-bdbc-055b37ae9e39">
|
||||
<database-info product="MariaDB" version="10.6.12-MariaDB-0ubuntu0.22.04.1" jdbc-version="4.2" driver-name="MariaDB Connector/J" driver-version="3.0.7" dbms="MARIADB" exact-version="10.6.12" exact-driver-version="3.0">
|
||||
<extra-name-characters>#@</extra-name-characters>
|
||||
<identifier-quote-string>`</identifier-quote-string>
|
||||
</database-info>
|
||||
<case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
|
||||
<secret-storage>master_key</secret-storage>
|
||||
<user-name>bye</user-name>
|
||||
<schema-mapping>
|
||||
<introspection-scope>
|
||||
<node kind="schema" qname="@" />
|
||||
</introspection-scope>
|
||||
</schema-mapping>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="ByeCorps ID (local)" uuid="5bc27beb-c8ab-420d-bdbc-055b37ae9e39">
|
||||
<driver-ref>mariadb</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mariadb://id.local:3306/id.local</jdbc-url>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
File diff suppressed because it is too large
Load Diff
|
@ -1,2 +0,0 @@
|
|||
#n:id
|
||||
!<md> [1700164719000, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,2 +0,0 @@
|
|||
#n:information_schema
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,2 +0,0 @@
|
|||
#n:mysql
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
|
@ -1,2 +0,0 @@
|
|||
#n:performance_schema
|
||||
!<md> [null, 0, null, null, -2147483648, -2147483648]
|
30
.idea/id.iml
30
.idea/id.iml
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/psr7" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/jean85/pretty-package-versions" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/phpmailer/phpmailer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-factory" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-message" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/log" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/ralouphie/getallheaders" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/sentry/sentry" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/deprecation-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/options-resolver" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/erusev/parsedown" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/erusev/parsedown-extra" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/kornrunner/blurhash" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/guzzle" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/guzzlehttp/promises" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-client" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/resend/resend-php" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/id.iml" filepath="$PROJECT_DIR$/.idea/id.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
|
@ -1,47 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="MessDetectorOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCSFixerOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PHPCodeSnifferOptionsConfiguration">
|
||||
<option name="highlightLevel" value="WARNING" />
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/vendor/psr/log" />
|
||||
<path value="$PROJECT_DIR$/vendor/jean85/pretty-package-versions" />
|
||||
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
|
||||
<path value="$PROJECT_DIR$/vendor/sentry/sentry" />
|
||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/psr7" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/options-resolver" />
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/phpmailer/phpmailer" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/http-factory" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/http-message" />
|
||||
<path value="$PROJECT_DIR$/vendor/erusev/parsedown" />
|
||||
<path value="$PROJECT_DIR$/vendor/erusev/parsedown-extra" />
|
||||
<path value="$PROJECT_DIR$/vendor/kornrunner/blurhash" />
|
||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/guzzle" />
|
||||
<path value="$PROJECT_DIR$/vendor/guzzlehttp/promises" />
|
||||
<path value="$PROJECT_DIR$/vendor/resend/resend-php" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/http-client" />
|
||||
</include_path>
|
||||
</component>
|
||||
<component name="PhpProjectSharedConfiguration" php_language_level="8.1" />
|
||||
<component name="PhpStanOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
<component name="PhpUnit">
|
||||
<phpunit_settings>
|
||||
<PhpUnitSettings custom_loader_path="$PROJECT_DIR$/vendor/autoload.php" />
|
||||
</phpunit_settings>
|
||||
</component>
|
||||
<component name="PsalmOptionsConfiguration">
|
||||
<option name="transferred" value="true" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="PROJECT" dialect="MariaDB" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -25,7 +25,7 @@ function get_avatar_url($bcid):string {
|
|||
|
||||
}
|
||||
|
||||
function get_display_name($bcid, $use_bcid_fallback=true, $put_bcid_in_parenthesis=false):string {
|
||||
function get_display_name($bcid, $use_bcid_fallback=true, $put_bcid_in_parenthesis=false, $format_bcid=false):string {
|
||||
$display_name = db_execute("SELECT display_name FROM accounts WHERE id = ?", [$bcid])['display_name'];
|
||||
if (!empty($display_name)) {
|
||||
if ($put_bcid_in_parenthesis) {
|
||||
|
|
|
@ -13,7 +13,7 @@ function check_app_id($app_id): bool
|
|||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
||||
$app_id = generate_app_id();
|
||||
db_execute("INSERT INTO apps (id, owner_id, title, description, type) VALUES (?, ?, ?, ?, ?)", [$app_id, $_POST['owner'], $_POST['title'], $_POST['description'], $_POST['type']]);
|
||||
db_execute("INSERT INTO apps (id, owner_id, title, description, type, callback) VALUES (?, ?, ?, ?, ?, ?)", [$app_id, $_POST['owner'], $_POST['title'], $_POST['description'], $_POST['type'], $_POST['callback']]);
|
||||
die();
|
||||
}
|
||||
|
||||
|
@ -40,5 +40,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
<option value="null">None</option>
|
||||
<option value="basic_login">Basic login</option>
|
||||
</select>
|
||||
<button type="submit">Create app</button>
|
||||
<label for="callback">Callback</label>
|
||||
<input type="url" id="callback" name="callback" />
|
||||
<button type="submit" class="primary">Create app</button>
|
||||
</form>
|
|
@ -6,15 +6,15 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||
echo "<p>Create table `accounts`";
|
||||
$stmt = $pdo->prepare('create table accounts
|
||||
(
|
||||
id varchar(7) not null
|
||||
id varchar(7) not null
|
||||
primary key,
|
||||
email text not null,
|
||||
created_date date default current_timestamp() not null,
|
||||
display_name text null,
|
||||
password text not null,
|
||||
verified tinyint(1) default 0 not null,
|
||||
has_pfp tinyint(1) default 0 not null,
|
||||
is_admin tinyint(1) default 0 not null,
|
||||
email text not null,
|
||||
created_date datetime default current_timestamp() not null,
|
||||
display_name text null,
|
||||
password text not null,
|
||||
verified tinyint(1) default 0 not null,
|
||||
has_pfp tinyint(1) default 0 not null,
|
||||
is_admin tinyint(1) default 0 not null,
|
||||
constraint email
|
||||
unique (email) using hash
|
||||
);');
|
||||
|
@ -73,6 +73,8 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||
title text not null,
|
||||
description text,
|
||||
image text default "https://id.byecorps.com/assets/default.png" not null,
|
||||
type text null,
|
||||
callback text null,
|
||||
constraint badges_ibfk_1
|
||||
foreign key (app_id) references apps (id)
|
||||
);');
|
||||
|
@ -89,6 +91,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||
description text null,
|
||||
public_avatar tinyint(1) default 0,
|
||||
public_display_name tinyint(1) default 0,
|
||||
|
||||
constraint profiles_ibfk_1
|
||||
foreign key (id) references accounts (id)
|
||||
);');
|
||||
|
@ -96,6 +99,26 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|||
echo('<p>An error occurred: '. $e->getMessage() .'. Most likely this is already set.');
|
||||
}
|
||||
|
||||
echo '<p>Create the `tokens` table';
|
||||
|
||||
try {
|
||||
db_execute('create table tokens (
|
||||
id int auto_increment primary key,
|
||||
access_token text unique,
|
||||
refresh_token text null,
|
||||
expiry int not null,
|
||||
owner_id varchar(7),
|
||||
application_id int(10) null,
|
||||
|
||||
constraint tokens_application_id
|
||||
foreign key (application_id) references apps (id),
|
||||
constraint tokens_owner_id
|
||||
foreign key (owner_id) references accounts (id)
|
||||
);');
|
||||
} catch (PDOException $e) {
|
||||
echo('<p>An error occurred: '. $e->getMessage() .'. Most likely this is already set.');
|
||||
}
|
||||
|
||||
|
||||
echo "<p>Database initialised.</p>";
|
||||
}
|
||||
|
|
|
@ -16,15 +16,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST") {
|
|||
// create a password reset
|
||||
$password_reset_link = create_password_reset($user['id']);
|
||||
|
||||
try {
|
||||
$safe_display_name = format_bcid($user['id']);
|
||||
} catch (Exception $e) {
|
||||
die("Bad BCID.");
|
||||
}
|
||||
|
||||
if ($user['display_name'] != '') {
|
||||
$safe_display_name = $user['display_name'];
|
||||
}
|
||||
$safe_display_name = get_display_name($user['id'], use_bcid_fallback: true);
|
||||
|
||||
|
||||
try {
|
||||
|
@ -41,7 +33,7 @@ If you did not request this password reset, please ignore it (or tighten your ac
|
|||
|
||||
// echo("<a href='$password_reset_link'>This is a security issue.</a>");
|
||||
} catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
echo "Message could not be sent. Mailer Error: $e";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -176,10 +176,10 @@ if ($include == "login_external_basic.php") {
|
|||
echo "<h2 class=\"subheading\">Admin</h2>";
|
||||
}
|
||||
|
||||
if ($uri[0] == "admin" && !$user['is_admin']) {
|
||||
http_response_code(401);
|
||||
die("<img src='https://http.cat/401.jpg' alt='A cat standing in front of a door with a No Cats Allowed sign on it.' />");
|
||||
}
|
||||
// if ($uri[0] == "admin" && !$user['is_admin']) {
|
||||
// http_response_code(401);
|
||||
// die("<img src='https://http.cat/401.jpg' alt='A cat standing in front of a door with a No Cats Allowed sign on it.' />");
|
||||
// }
|
||||
|
||||
if ($uri[0] == "docs") {
|
||||
$include = "docs.php";
|
||||
|
|
|
@ -11,7 +11,7 @@ $profile = db_execute("SELECT * FROM `profiles` WHERE id = ? LIMIT 1", [$user['i
|
|||
|
||||
if (empty($profile)) {
|
||||
$profile = [
|
||||
"id" => "0000000",
|
||||
"id" => "9999999",
|
||||
"public_display_name" => false,
|
||||
"public_avatar" => false,
|
||||
"description" => null,
|
||||
|
|
Loading…
Reference in New Issue