Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/112 session #113

Merged
merged 2 commits into from
Feb 19, 2024
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
46 changes: 25 additions & 21 deletions assets/client/components/account/AccountBalance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
getFormattedNextPayday,
} from '@/client/utils/date';
import { Locale } from '@/client/interfaces/Locale';
import { pathToRoute } from '@/client/utils/pathToRoute';

export default function AccountBalance() {
const { t, i18n } = useTranslation();
Expand Down Expand Up @@ -54,33 +55,36 @@ export default function AccountBalance() {
return (
<AccountLayout
title={t('PAGE_HEADER.PAGE_NAME.OVERVIEW')}
backTo={`/accounts/${id}`}
backTo={pathToRoute('accounts_dashboard', { id })}
>
<div className="custom-container no-transparency">
{isLoading && <Loading />}
<div className="custom-text-box">
{balance && <div className="balance-display">{balance}</div>}
{isLoading ? (
<Loading />
) : (
<div className="custom-text-box">
{balance && <div className="balance-display">{balance}</div>}

<div className="funny-image-wrapper">
<figure>
<img src={imagePath} alt="funny image" />
</figure>
</div>
<div className="payday-info">
<div>
{t('OVERVIEW.PAYDAY_WEEKDAY_LABEL')}&nbsp;
<span className="bold-text">
{nextPayday ?? t('OVERVIEW.PAYDAY_WEEKDAY_UNKNOWN')}
</span>
<div className="funny-image-wrapper">
<figure>
<img src={imagePath} alt="funny image" />
</figure>
</div>
<div>
{t('OVERVIEW.PAYDAY_COUNTER_LABEL')}&nbsp;
<span className="bold-text">
{daysUntilNextPayday ?? t('OVERVIEW.PAYDAY_COUNTER_UNKNOWN')}
</span>
<div className="payday-info">
<div>
{t('OVERVIEW.PAYDAY_WEEKDAY_LABEL')}&nbsp;
<span className="bold-text">
{nextPayday ?? t('OVERVIEW.PAYDAY_WEEKDAY_UNKNOWN')}
</span>
</div>
<div>
{t('OVERVIEW.PAYDAY_COUNTER_LABEL')}&nbsp;
<span className="bold-text">
{daysUntilNextPayday ?? t('OVERVIEW.PAYDAY_COUNTER_UNKNOWN')}
</span>
</div>
</div>
</div>
</div>
)}
</div>
</AccountLayout>
);
Expand Down
5 changes: 4 additions & 1 deletion assets/client/components/account/AccountDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export default function AccountDashboard() {
];

return (
<AccountLayout title={t('PAGE_HEADER.PAGE_NAME.DASHBOARD')}>
<AccountLayout
title={t('PAGE_HEADER.PAGE_NAME.DASHBOARD')}
backTo={pathToRoute('dashboard')}
>
<div className="custom-container no-transparency">
<div className="button-container">
{sections.map((section, index) => (
Expand Down
3 changes: 3 additions & 0 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ security:
# Note: Only the *first* access control that matches will be used
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/accounts/, roles: ROLE_USER }
- { path: ^/user/, roles: ROLE_USER }
- { path: ^/dashboard, roles: ROLE_USER }
# - { path: ^/profile, roles: ROLE_USER }

when@test:
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/SecurityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function login(AuthenticationUtils $authenticationUtils): Response
'csrf_token_intention' => 'authenticate',

// the URL users are redirected to after the login (default: '/admin')
'target_path' => '/accountselection',
'target_path' => '/dashboard',

// the label displayed for the username form field (the |trans filter is applied to it)
'username_label' => 'Your username',
Expand Down
11 changes: 0 additions & 11 deletions src/Factory/UserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,4 @@ protected function getDefaults(): array
'roles' => [UserRole::USER],
];
}

/**
* @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization
*/
protected function initialize(): self
{
return $this
->afterInstantiate(function (User $user) {
$user->setPassword($this->passwordHasher->hashPassword($user, $user->getPassword()));
});
}
}
Loading