Bootstrap 5 continued + bugfixes

This commit is contained in:
Joey Kimsey
2024-12-15 17:19:08 -05:00
parent de6d608857
commit 2220c6cda3
27 changed files with 198 additions and 148 deletions

View File

@ -214,6 +214,10 @@ class Forms extends Check {
* @return {bool}
*/
public static function passwordResetCode() {
if ( !Input::exists( 'resetCode' ) ) {
self::addUserError( 'Invalid resetCode.' );
return false;
}
if ( !self::token() ) {
return false;
}

View File

@ -212,12 +212,13 @@ class Preferences {
}
if ( 'file' == $details['type'] ) {
if ( Input::exists( $name ) ) {
$folder = IMAGE_UPLOAD_DIRECTORY . App::$activeUser->username . DIRECTORY_SEPARATOR;
if ( !Upload::image( $name, $folder ) ) {
Issues::add( 'error', [ 'There was an error with your upload.' => Check::systemErrors() ] );
} else {
$folder = UPLOAD_DIRECTORY . App::$activeUser->username . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR;
$upload = Upload::image( $name, $folder );
if ( $upload ) {
$route = str_replace( APP_ROOT_DIRECTORY, '', $folder );
$prefsArray[$name] = $route . Upload::last();
} else {
Issues::add( 'error', [ 'There was an error with your upload.' => Check::userErrors() ] );
}
}
}

View File

@ -29,14 +29,14 @@ class Register extends Controller {
public function confirm( $code = null ) {
self::$title = 'Confirm Email';
if ( !isset( $code ) && !Input::exists( 'confirmationCode' ) ) {
return Views::view( 'email.confirmation' );
return Views::view( 'confirmation' );
}
if ( Forms::check( 'emailConfirmation' ) ) {
$code = Input::post( 'confirmationCode' );
}
if ( !self::$user->confirm( $code ) ) {
Issues::add( 'error', 'There was an error confirming your account, please try again.' );
return Views::view( 'email.confirmation' );
return Views::view( 'confirmation' );
}
Session::flash( 'success', 'You have successfully confirmed your email address.' );
Redirect::to( 'home/index' );
@ -97,13 +97,13 @@ class Register extends Controller {
if ( !App::$isLoggedIn ) {
return Issues::add( 'notice', 'Please log in to resend your confirmation email.' );
}
if ( App::$activeUser->data()->confirmed == '1' ) {
if ( App::$activeUser->confirmed == '1' ) {
return Issues::add( 'notice', 'Your account has already been confirmed.' );
}
if ( !Forms::check( 'confirmationResend' ) ) {
return Views::view( 'email.confirmation_resend' );
return Views::view( 'confirmation_resend' );
}
Email::send( App::$activeUser->data()->email, 'confirmation', App::$activeUser->data()->confirmationCode, [ 'template' => true ] );
Email::send( App::$activeUser->email, 'confirmation', App::$activeUser->confirmationCode, [ 'template' => true ] );
Session::flash( 'success', 'Your confirmation email has been sent to the email for your account.' );
Redirect::to( 'home/index' );
}
@ -111,26 +111,26 @@ class Register extends Controller {
public function reset( $code = null ) {
self::$title = 'Password Reset';
if ( !isset( $code ) && !Input::exists( 'resetCode' ) ) {
Issues::add( 'error', 'No reset code provided.' );
Issues::add( 'info', 'Please provide a reset code.' );
return Views::view( 'password_reset_code' );
}
if ( Input::exists( 'resetCode' ) ) {
if ( Forms::check( 'password_reset_code' ) ) {
if ( Forms::check( 'passwordResetCode' ) ) {
$code = Input::post( 'resetCode' );
}
}
if ( !self::$user->checkCode( $code ) ) {
if ( ! self::$user->checkCode( $code ) ) {
Issues::add( 'error', 'There was an error with your reset code. Please try again.' );
return Views::view( 'password_reset_code' );
}
if ( !Input::exists() ) {
Components::set( 'resetCode', $code );
if ( ! Input::exists('password') ) {
return Views::view( 'password_reset' );
}
if ( !Forms::check( 'passwordReset' ) ) {
if ( ! Forms::check( 'passwordReset' ) ) {
Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );
return Views::view( 'password_reset' );
}
Components::set( 'resetCode', $code );
self::$user->changePassword( $code, Input::post( 'password' ) );
Email::send( self::$user->data()->email, 'passwordChange', null, [ 'template' => true ] );
Session::flash( 'success', 'Your Password has been changed, please use your new password to log in.' );

View File

@ -43,7 +43,7 @@ class Usercp extends Controller {
public function email() {
self::$title = 'Email Settings';
if ( App::$activeUser->confirmed != '1' ) {
return Issues::add( 'notice', 'You need to confirm your email address before you can make modifications. If you would like to resend that confirmation link, please <a href="{BASE}register/resend">click here</a>', true );
return Issues::add( 'notice', 'You need to confirm your email address before you can make modifications. If you would like to resend that confirmation link, please <a href="/register/resend">click here</a>', true );
}
if ( !Input::exists() ) {
return Views::view( 'user_cp.email_change' );
@ -98,6 +98,7 @@ class Usercp extends Controller {
$fields = App::$activePrefs;
if ( Input::exists( 'submit' ) ) {
$fields = $prefs->convertFormToArray( true, false );
// dv( $fields );
// @TODO now i may need to rework the form checker to work with this....
// if (!Forms::check('userPrefs')) {
// Issues::add( 'error', [ 'There was an error with your request.' => Check::userErrors() ] );

View File

@ -102,4 +102,18 @@ function generateRandomString( $length = 10 ) {
$randomString .= $characters[random_int(0, $charactersLength - 1)];
}
return $randomString;
}
function generateUuidV4(): string {
// Generate 16 random bytes
$data = random_bytes(16);
// Set the version to 4 -> random (bits 12-15 of time_hi_and_version)
$data[6] = chr((ord($data[6]) & 0x0f) | 0x40);
// Set the variant to RFC 4122 -> (bits 6-7 of clock_seq_hi_and_reserved)
$data[8] = chr((ord($data[8]) & 0x3f) | 0x80);
// Convert to hexadecimal and format as a UUID
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
}

View File

@ -1,5 +1,5 @@
<legend>New Posts</legend>
<table class="table table-striped">
<table class="table context-main">
<thead>
<tr>
<th style="width: 20%"></th>

View File

@ -53,6 +53,7 @@ class Bugreport extends Plugin {
[
'text' => 'Bug Report',
'url' => '{ROOT_URL}bugreport',
'filter' => 'loggedin',
],
];
public $admin_links = [

View File

@ -1,5 +1,5 @@
<legend>New Comments</legend>
<table class="table table-striped">
<table class="table context-main">
<thead>
<tr>
<th style="width: 20%"></th>

View File

@ -8,7 +8,7 @@
id="comment"
placeholder="Write your comment here..."></textarea>
</div>
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary">Comment</button>
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary mb-3">Comment</button>
<input type="hidden" name="token" value="{TOKEN}">
<input type="hidden" name="contentId" value="{CONTENT_ID}">
</form>

View File

@ -53,7 +53,7 @@ class Contact extends Plugin {
];
public $admin_links = [
[
'text' => '<i class="fa fa-fw fa-support"></i> Contact',
'text' => '<i class="fa fa-fw fa-briefcase"></i> Contact',
'url' => '{ROOT_URL}admin/contact',
],
];

View File

@ -67,9 +67,9 @@
</div>
<!-- Footer -->
<footer class="bg-light border-top">
<div class="container py-3">
<div class="d-flex justify-content-between">
<footer class="border-top context-main-bg">
<div class="container pb-4 pt-3 align-items-center">
<div class="d-flex justify-content-between align-items-center context-main-bg">
{COPY}
{SOCIAL}
</div>

View File

@ -63,9 +63,7 @@
</div>
</div>
{/ISSUES}
<div class="">
{CONTENT}
</div>
{CONTENT}
</div>
{FOOT}
</div>

View File

@ -1,14 +1,16 @@
<legend>Admin Dashboard</legend>
<div class="row">
<div class="col-xlg-6 col-lg-6 col-md-6 col-sm-6">
{userDash}
<div class="context-main-bg context-main">
<legend class="text-center my-2">Admin Dashboard</legend>
<div class="row">
<div class="col-5 offset-1">
{userDash}
</div>
<div class="col-5">
{commentDash}
</div>
</div>
<div class="col-xlg-6 col-lg-6 col-md-6 col-sm-6">
{commentDash}
</div>
</div>
<div class="row">
<div class="col-xlg-12 col-lg-12 col-md-12 col-sm-12">
{blogDash}
<div class="row">
<div class="col-10 offset-1">
{blogDash}
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<legend>New Users</legend>
<table class="table table-striped">
<table class="table context-main">
<thead>
<tr>
<th style="width: 85%"></th>

View File

@ -0,0 +1,15 @@
<div class="container py-5 context-main-bg my-5 text-center">
<h1 class="mb-4">Email Confirmation</h1>
<hr>
<p>Please enter the confirmation code you received in your email.</p>
<form action="" method="post" class="">
<fieldset>
<div data-mdb-input-init class="form-outline mb-4 col-2 offset-5">
<input class="form-control" type="text" name="confirmationCode" id="confirmationCode" placeholder="Confirmation Code">
</div>
</fieldset>
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Submit</button><br>
</form>
</div>

View File

@ -0,0 +1,10 @@
<div class="container py-5 context-main-bg my-5 text-center">
<h1 class="mb-4">Re-Send Confirmation</h1>
<hr>
<p>Please click the resend button to resend your email confirmation. Don't forget to check the spam folder!</p>
<form action="" method="post" class="">
<input type="hidden" name="resendConfirmation" value="true">
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Resend Confirmation</button><br>
</form>
</div>

View File

@ -1,4 +1,3 @@
<div class="container py-5 context-main-bg my-5">
<h1 class="mb-4">Frequently Asked Questions</h1>
<hr>

View File

@ -1 +1 @@
<p>© 2024 AllTheBookmarks, Powered by <a href="https://thetempusproject.com" class="text-decoration-none">The Tempus Project</a>.</p>
<span>© 2024 AllTheBookmarks, Powered by <a href="https://thetempusproject.com" class="text-decoration-none">The Tempus Project</a>.</span>

View File

@ -1,4 +1,4 @@
<ul class="list-unstyled d-flex">
<ul class="list-unstyled d-flex mb-0">
<li class="ms-3">
<a class="context-main" href="{ROOT_URL}fb">
<span class="fa-brands fa-fw fa-facebook"></span>

View File

@ -1,13 +1,13 @@
<form action="" method="post" class="form-horizontal">
<legend>Lost and Found</legend>
<fieldset>
<div class="form-group">
<label for="entry" class="col-lg-3 control-label">Username or Email:</label>
<div class="col-lg-3">
<input class="form-control" type="text" name="entry" id="entry">
<div class="col-8 mx-auto p-4 rounded shadow-sm mb-5 context-main-bg mt-4 text-center">
<form action="" method="post">
<legend class=" my-2">Lost and Found</legend>
<p class="col-8 offset-2">You can begin the process of recovering your account here. Provide your username, or email address and instructions for ressetting your password will be mailed to you shortly.</p>
<fieldset>
<div data-mdb-input-init class="form-outline mb-4 col-2 offset-5">
<input name="entry" type="text" id="entry" class="form-control" placeholder="Username or Email" />
</div>
</div>
</fieldset>
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Reset Password</button><br>
</form>
</fieldset>
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Reset Password</button><br>
</form>
</div>

View File

@ -1,56 +1,48 @@
<section class="h-100 gradient-form pt-5 context-main-bg">
<div class="container pb-5 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-xl-10">
<div class="card rounded-3 text-black">
<div class="row g-0">
<div class="col-lg-6">
<div class="card-body p-md-5 mx-md-4">
<div class="text-center">
<img src="{ROOT_URL}{LOGO}" style="width: 185px;" alt="logo">
<h4 class="mt-1 mb-5 pb-1">AllTheBookmarks</h4>
</div>
<form action="{ROOT_URL}home/login" method="post">
<p>Please login to your account</p>
<div data-mdb-input-init class="form-outline mb-4">
<input name="username" type="text" id="username" class="form-control" placeholder="Username" />
<section class="h-100 gradient-form">
<div class="container pb-5 h-100 context-main-bg pt-5">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-xl-10">
<div class="card rounded-3 text-black">
<div class="row g-0">
<div class="col-lg-6">
<div class="card-body p-md-5 mx-md-4">
<div class="text-center">
<img src="{ROOT_URL}{LOGO}" style="width: 185px;" alt="logo">
<h4 class="mt-1 mb-5 pb-1">AllTheBookmarks</h4>
</div>
<form action="{ROOT_URL}home/login" method="post">
<p>Please login to your account</p>
<div data-mdb-input-init class="form-outline mb-4">
<input name="username" type="text" id="username" class="form-control" placeholder="Username" />
</div>
<div data-mdb-input-init class="form-outline mb-4">
<input name="password" type="password" id="password" class="form-control" placeholder="password" />
</div>
<div class="text-center pt-1 mb-5 pb-1">
<button name="submit" value="submit" type="submit" data-mdb-button-init data-mdb-ripple-init class="btn btn-primary btn-block fa-lg gradient-custom-2 mb-3">
Sign in
</button>
<a class="text-muted" href="{ROOT_URL}register/recover">Forgot password?</a>
</div>
<div class="d-flex align-items-center justify-content-center pb-4">
<p class="mb-0 me-2">Don't have an account?</p>
<a href="{ROOT_URL}register" data-mdb-button-init data-mdb-ripple-init class="btn btn-outline-dark">
Create new
</a>
</div>
<input type="hidden" name="token" value="{TOKEN}">
</form>
</div>
</div>
<div class="col-lg-6 d-flex align-items-center gradient-custom-2">
<div class="text-white px-3 py-4 p-md-5 mx-md-4">
<h4 class="mb-4">I appreciate you.</h4>
<p class="small mb-0">As a solo developer, i appreciate each and every person who uses my products. There aren't many of you, so thank you</p>
</div>
</div>
</div>
<div data-mdb-input-init class="form-outline mb-4">
<input name="password" type="password" id="password" class="form-control" placeholder="password" />
</div>
<div class="text-center pt-1 mb-5 pb-1">
<button name="submit" value="submit" type="submit" data-mdb-button-init data-mdb-ripple-init class="btn btn-primary btn-block fa-lg gradient-custom-2 mb-3">Sign
in</button>
<a class="text-muted" href="{ROOT_URL}register/recover">Forgot password?</a>
</div>
<div class="d-flex align-items-center justify-content-center pb-4">
<p class="mb-0 me-2">Don't have an account?</p>
<a href="{ROOT_URL}register">
<button type="button" data-mdb-button-init data-mdb-ripple-init class="btn btn-outline-dark">Create new</button>
</a>
</div>
<input type="hidden" name="token" value="{TOKEN}">
</form>
</div>
</div>
<div class="col-lg-6 d-flex align-items-center gradient-custom-2">
<div class="text-white px-3 py-4 p-md-5 mx-md-4">
<h4 class="mb-4">I appreciate you.</h4>
<p class="small mb-0">As a solo developer, i appreciate each and every person who uses my products. There aren't many of you, so thank you</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</section>

View File

@ -9,7 +9,7 @@
aria-expanded="false">
<img src="{ROOT_URL}{AVATAR}" alt="" width="32" height="32" class="rounded-circle me-2"> <strong class="mr-3">{USERNAME}</strong>
</a>
<ul class="dropdown-menu dropdown-menu-dark text-small shadow" aria-labelledby="userDropdown">
<ul class="dropdown-menu dropdown-menu-dark dropdown-menu-end text-small shadow" aria-labelledby="userDropdown">
<li><a href="{ROOT_URL}usercp" class="dropdown-item"><i class="fa fa-fw fa-user"></i> Profile</a></li>
{topNavRightDropdown}
<li><a href="{ROOT_URL}usercp/settings" class="dropdown-item"><i class="fa fa-fw fa-gear"></i> Settings</a></li>

View File

@ -9,29 +9,27 @@
aria-expanded="false">
<i class="fa fa-user"></i>
</a>
<div class="dropdown-menu dropdown-menu-dark text-small shadow" aria-labelledby="userDropdown">
<div class="dropdown-menu dropdown-menu-dark dropdown-menu-end text-small shadow" aria-labelledby="userDropdown">
<form method="post" action="{ROOT_URL}home/login" id="signin" class="px-4 py-3">
<input type="hidden" name="rurl" id="rurl" value="{CURRENT_URL}">
<input type="hidden" name="token" value="{TOKEN}">
<!-- Username -->
<div class="form-group">
<label for="username">Username</label>
<input
id="username"
type="text"
class="form-control"
class="form-control mb-2"
name="username"
placeholder="Username">
</div>
<!-- Password -->
<div class="form-group">
<label for="password">Password</label>
<input
id="password"
type="password"
class="form-control"
class="form-control mb-2"
name="password"
placeholder="Password">
</div>
@ -40,7 +38,7 @@
<div class="form-check">
<input
type="checkbox"
class="form-check-input"
class="form-check-input mb-2"
id="remember"
name="remember">
<label class="form-check-label" for="remember">Remember me</label>
@ -49,7 +47,7 @@
<!-- Submit Button -->
<button
type="submit"
class="btn btn-primary btn-block mt-3"
class="btn btn-primary btn-block"
name="submit"
value="submit">
Sign in

View File

@ -1,20 +1,18 @@
<form action="" method="post" class="form-horizontal">
<legend>Change Password</legend>
<fieldset>
<div class="form-group">
<label for="password" class="col-lg-3 control-label">New Password:</label>
<div class="col-lg-3">
<input class="form-control" type="password" name="password" id="password">
<div class="container py-5 context-main-bg my-5 text-center">
<h1 class="mb-4">Change Password</h1>
<hr>
<p>Please enter the confirmation code you received in your email.</p>
<form action="" method="post" class="">
<fieldset>
<div data-mdb-input-init class="form-outline mb-4 col-2 offset-5">
<input class="form-control" type="password" name="password" id="password" placeholder="New Password">
</div>
</div>
<div class="form-group">
<label for="password2" class="col-lg-3 control-label">Re-Type New Password:</label>
<div class="col-lg-3">
<input class="form-control" type="password" name="password2" id="password2">
<div data-mdb-input-init class="form-outline mb-4 col-2 offset-5">
<input class="form-control" type="password" name="password2" id="password2" placeholder="New Password Confirmation">
</div>
</div>
</fieldset>
<input type="hidden" name="resetCode" value="{resetCode}">
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Submit</button><br>
</form>
</fieldset>
<input type="hidden" name="resetCode" value="{resetCode}">
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Submit</button><br>
</form>
</div>

View File

@ -1,14 +1,14 @@
<form action="" method="post" class="form-horizontal">
<legend>Change Password</legend>
<div class="container py-5 context-main-bg my-5 text-center">
<h1 class="mb-4">Change Password</h1>
<hr>
<p>Please enter the code you received in your email. If you did not receive the code, please check your spam filter or <a href="{ROOT_URL}">click here</a> to request a new reset code.</p>
<fieldset>
<div class="form-group">
<label for="resetCode" class="col-lg-3 control-label">Reset Code</label>
<div class="col-lg-3">
<input class="form-control" type="text" name="resetCode" id="resetCode">
<form action="" method="post" class="">
<fieldset>
<div data-mdb-input-init class="form-outline mb-4 col-2 offset-5">
<input class="form-control" type="text" name="resetCode" id="resetCode" placeholder="Password Reset Code">
</div>
</div>
</fieldset>
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Submit</button><br>
</form>
</fieldset>
<input type="hidden" name="token" value="{TOKEN}">
<button name="submit" value="submit" type="submit" class="btn btn-lg btn-primary center-block">Submit</button><br>
</form>
</div>