- Add complete Auth module with login, logout, lock screen functionality - Fix 401 error on error monitoring page by adding /error-monitoring/ to public patterns - Improve lock screen with proper form handling and unlock functionality - Add RoleModel and role management views - Add BaseModel for common model functionality - Update authentication system and middleware - Add troubleshooting documentation - Update assets and build tools
133 lines
5.9 KiB
PHP
133 lines
5.9 KiB
PHP
<?php
|
|
use App\Core\View;
|
|
use App\Core\AssetManager;
|
|
|
|
$page_title = 'Auth pass reset basic';
|
|
$page_description = 'Página Auth pass reset basic';
|
|
|
|
View::render('layouts/auth.php', [
|
|
'title' => $page_title,
|
|
'description' => $page_description,
|
|
'page_content' => function() {
|
|
?>
|
|
|
|
<div class="auth-page-wrapper pt-5">
|
|
<div class="auth-one-bg-position auth-one-bg" id="auth-particles">
|
|
<div class="bg-overlay"></div>
|
|
<div class="shape">
|
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1440 120">
|
|
<path d="M 0,36 C 144,53.6 432,123.2 720,124 C 1008,124.8 1296,56.8 1440,40L1440 140L0 140z"></path>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="auth-page-content">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="text-center mt-sm-5 mb-4 text-white-50">
|
|
<div>
|
|
<a href="/index/" class="d-inline-block auth-logo">
|
|
<img src="<?php echo \App\Core\AppConfig::getLogoLight(); ?>" alt="" height="20">
|
|
</a>
|
|
</div>
|
|
<p class="mt-3 fs-15 fw-medium">BitReport CRM - Sistema de Gestão Empresarial</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-8 col-lg-6 col-xl-5">
|
|
<div class="card mt-4">
|
|
<div class="card-body p-4">
|
|
<div class="text-center mt-2">
|
|
<h5 class="text-primary">Forgot Password?</h5>
|
|
<p class="text-muted">Reset password with <?php echo \App\Core\AppConfig::getCompanyName(); ?></p>
|
|
<lord-icon src="/assets/lordicon/rhvddzym.json" trigger="loop" colors="primary:#0ab39c" class="avatar-xl"></lord-icon>
|
|
</div>
|
|
|
|
<div class="alert border-0 alert-warning text-center mb-2 mx-2" role="alert">
|
|
Enter your email and instructions will be sent to you!
|
|
</div>
|
|
|
|
<div class="p-2" x-data="resetPassword()">
|
|
<div x-show="success" class="alert alert-success text-center mb-4 mt-4 pt-2" role="alert">We have emailed your password reset link!</div>
|
|
<form @submit.prevent="submit">
|
|
<div class="mb-4">
|
|
<label class="form-label">Email</label>
|
|
<input type="email" class="form-control" x-model="email" placeholder="Enter Email" required>
|
|
<span class="text-danger" x-text="error"></span>
|
|
</div>
|
|
<div class="text-center mt-4">
|
|
<button class="btn btn-success w-100" type="submit" :disabled="loading">
|
|
<span x-show="!loading">Send Reset Link</span>
|
|
<span x-show="loading">Sending...</span>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-4 text-center">
|
|
<p class="mb-0">Wait, I remember my password... <a href="/auth-signin-basic/" class="fw-semibold text-primary text-decoration-underline"> Click here </a> </p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<footer class="footer">
|
|
<div class="container">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="text-center">
|
|
<p class="mb-0 text-muted">©
|
|
<script>document.write(new Date().getFullYear())</script> <?php echo \App\Core\AppConfig::getCompanyName(); ?>.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
</div>
|
|
|
|
<script>
|
|
function resetPassword(){
|
|
return {
|
|
email: '',
|
|
loading: false,
|
|
error: '',
|
|
success: false,
|
|
async submit(){
|
|
this.error = '';
|
|
this.success = false;
|
|
this.loading = true;
|
|
try{
|
|
const res = await fetch('/api/auth/password-reset', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ email: this.email })
|
|
});
|
|
const data = await res.json();
|
|
if(res.ok && data.success){
|
|
this.success = true;
|
|
} else {
|
|
this.error = data.message || 'Failed to process request';
|
|
}
|
|
} catch(e){
|
|
this.error = 'Network error';
|
|
} finally {
|
|
this.loading = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<?php
|
|
},
|
|
'scripts' => function() {
|
|
AssetManager::addFooterJs(View::asset('/assets/libs/particles.js/particles.js'));
|
|
AssetManager::addFooterJs(View::asset('/assets/js/pages/particles.app.js'));
|
|
}
|
|
]);
|