Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ log.txt

.idea

node_modules/
node_modules/
/.phpunit.result.cache
3 changes: 1 addition & 2 deletions migrations/08-add-reset-token-expiry.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
-- BUG-09 : Ajoute la date d'expiration du token de réinitialisation de mot de passe
ALTER TABLE users ADD COLUMN reset_token_expires_at DATETIME NULL DEFAULT NULL AFTER reset_token;

ALTER TABLE {prefix}users ADD COLUMN reset_token_expires_at DATETIME NULL DEFAULT NULL AFTER reset_token;
15 changes: 15 additions & 0 deletions migrations/11-move-goal-to-stream-event.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Ajouter la colonne goal aux tables stream et event
ALTER TABLE {prefix}charity_stream ADD goal INT NOT NULL DEFAULT 1000;
ALTER TABLE {prefix}charity_event ADD goal INT NOT NULL DEFAULT 1000;

-- Copier les objectifs existants depuis les widgets barre de don
UPDATE {prefix}charity_stream cs
INNER JOIN {prefix}widget_donation_goal_bar w ON w.charity_stream_guid = cs.guid
SET cs.goal = w.goal
WHERE w.goal IS NOT NULL AND w.goal > 0;

UPDATE {prefix}charity_event ce
INNER JOIN {prefix}widget_donation_goal_bar w ON w.charity_event_guid = ce.guid
SET ce.goal = w.goal
WHERE w.goal IS NOT NULL AND w.goal > 0;

3 changes: 3 additions & 0 deletions migrations/12-add-email-verified.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-- Ajoute le champ de vérification d'email pour l'inscription
ALTER TABLE {prefix}users ADD COLUMN email_verified TINYINT(1) NOT NULL DEFAULT 1 AFTER password;

8 changes: 6 additions & 2 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,23 @@ function (\Psr\Http\Message\ServerRequestInterface $request, \Throwable $excepti
true // handleSubclasses
);
$app->get('/', [HomeController::class, 'index'])->setName('app_index');
$app->get('/register', [HomeController::class, 'register'])->setName('app_register');
$app->get('/forgot_password', [HomeController::class, 'forgotPassword'])->setName('app_forgot_password');
$app->get('/reset_password/{token}', [HomeController::class, 'resetPassword'])->setName('app_reset_password');

$app->post('/login', [LoginController::class, 'login'])->setName('app_login');
$app->post('/register', [LoginController::class, 'register'])->setName('app_register_post');
$app->get('/verify-email/{token}', [LoginController::class, 'verifyEmail'])->setName('app_verify_email');
$app->get('/logout', [LoginController::class, 'logout'])->add(new AuthMiddleware())->setName('app_logout');
$app->post('/forgot_password', [LoginController::class, 'forgotPassword'])->setName('app_forgot_password_post');
$app->post('/reset_password', [LoginController::class, 'resetPassword'])->setName('app_reset_password_post');
$app->get('/redirect_auth_page', [LoginController::class, 'redirectAuthPage'])->setName('app_redirect_auth_page');
$app->get('/validate_auth_page', [LoginController::class, 'validateAuthPage'])->setName('app_validate_auth_page');

$app->get('/admin', [AdminController::class, 'index'])->add(new AuthMiddleware())->setName('app_admin_index');
$app->post('/admin/event', [AdminController::class, 'newEvent'])->add(new AuthAdminMiddleware())->setName('app_event_new');
$app->post('/admin/event/{id}/delete', [AdminController::class, 'deleteEvent'])->add(new AuthAdminMiddleware())->setName('app_event_delete');
$app->post('/admin/user', [AdminController::class, 'newUser'])->add(new AuthAdminMiddleware())->setName('app_user_new');
$app->post('/admin/event', [AdminController::class, 'newEvent'])->add(new AuthMiddleware())->setName('app_event_new');
$app->post('/admin/event/{id}/delete', [AdminController::class, 'deleteEvent'])->add(new AuthMiddleware())->setName('app_event_delete');
$app->get('/admin/event/{id}/edit', [AdminController::class, 'editEvent'])->add(new AuthMiddleware())->setName('app_event_edit');
$app->post('/admin/event/{id}/edit', [AdminController::class, 'editEventPost'])->add(new AuthMiddleware())->setName('app_event_edit_post');
$app->post('/admin/stream', [AdminController::class, 'newStream'])->add(new AuthMiddleware())->setName('app_stream_new');
Expand Down
14 changes: 9 additions & 5 deletions src/Assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ function updateDonationGoalPreview() {
const front = document.querySelector('.front');
const backTitle = document.getElementById('back-title');
const frontTitle = document.getElementById('front-title');
const goal = document.getElementById('goal');
// L'objectif est maintenant dans le formulaire d'infos (stream_goal ou event_goal)
const goalInput = document.getElementById('stream_goal') || document.getElementById('event_goal');

back.style.backgroundColor = document.getElementById('background_color').value;
front.style.backgroundColor = document.getElementById('bar_color').value;
Expand All @@ -29,7 +30,7 @@ function updateDonationGoalPreview() {
backTitle.textContent = textContent;
frontTitle.textContent = textContent;

const goalValue = parseFloat(goal.value) || 0;
const goalValue = goalInput ? (parseFloat(goalInput.value) || 0) : 0;
const currentDonation = goalValue / 2;

document.getElementById('back-goal-total').textContent = `${goalValue} €`;
Expand All @@ -43,7 +44,7 @@ function updateDonationGoalPreview() {
const donationBarForm = document.getElementById('donationBarForm');
if (donationBarForm) {
bindPreviewInputs(
['text_color_main', 'text_color_alt', 'text_content', 'bar_color', 'background_color', 'goal'],
['text_color_main', 'text_color_alt', 'text_content', 'bar_color', 'background_color', 'stream_goal', 'event_goal'],
updateDonationGoalPreview
);
}
Expand Down Expand Up @@ -74,7 +75,9 @@ if (cardWidgetForm) {
const barBgColor = document.getElementById('card_bar_background_color').value;
const tagColor = document.getElementById('card_tag_color').value;
const tagBgColor = document.getElementById('card_tag_background_color').value;
const goalValue = parseFloat(document.getElementById('card_goal').value) || 1;
// L'objectif est maintenant dans le formulaire d'infos (stream_goal ou event_goal)
const goalInput = document.getElementById('stream_goal') || document.getElementById('event_goal');
const goalValue = goalInput ? (parseFloat(goalInput.value) || 1) : 1;

if (preview) {
preview.style.backgroundColor = bgColor;
Expand All @@ -101,9 +104,10 @@ if (cardWidgetForm) {

bindPreviewInputs(
[
'card_tag', 'card_title', 'card_description', 'card_goal',
'card_tag', 'card_title', 'card_description',
'card_background_color', 'card_text_color', 'card_bar_color',
'card_bar_background_color', 'card_tag_color', 'card_tag_background_color',
'stream_goal', 'event_goal',
],
updateCardPreview
);
Expand Down
Loading
Loading