Skip to content

Commit 9b48e9f

Browse files
Merge pull request #22 from sumocoders/fixes
Fixes
2 parents b77547f + fc8b9ae commit 9b48e9f

18 files changed

+36
-28
lines changed

config/packages/security.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ security:
3939
ROLE_SUPER_ADMIN: [ ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
4040

4141
access_control:
42+
- { path: ^/admin/users/ajax/password-strength, roles: PUBLIC_ACCESS }
4243
- { path: ^/admin, roles: ROLE_ADMIN }
4344
- { path: ^/profile, roles: ROLE_USER }
4445
- { path: ^/login, roles: PUBLIC_ACCESS }

migrations/Version20210413143447.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,25 @@
1212
*/
1313
final class Version20210413143447 extends AbstractMigration
1414
{
15-
public function getDescription() : string
15+
public function getDescription(): string
1616
{
17-
return 'Set up the user table for MySQL';
17+
return '';
1818
}
1919

20-
public function up(Schema $schema) : void
20+
public function up(Schema $schema): void
2121
{
2222
// this up() migration is auto-generated, please modify it to your needs
23-
$this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) NOT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, confirmation_requested_at DATETIME DEFAULT NULL, confirmed_at DATETIME DEFAULT NULL, password_reset_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
23+
$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, password VARCHAR(255) DEFAULT NULL, enabled TINYINT(1) NOT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, confirmation_requested_at DATETIME DEFAULT NULL, confirmed_at DATETIME DEFAULT NULL, password_reset_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
2424
}
2525

26-
public function down(Schema $schema) : void
26+
public function down(Schema $schema): void
2727
{
2828
// this down() migration is auto-generated, please modify it to your needs
29-
$this->addSql('DROP TABLE `user`');
29+
$this->addSql('DROP TABLE user');
30+
}
31+
32+
public function isTransactional(): bool
33+
{
34+
return false;
3035
}
3136
}

src/Controller/HomeController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ class HomeController extends AbstractController
1212
#[Route('/', name: 'home')]
1313
public function __invoke(): Response
1414
{
15-
return $this->redirectToRoute(ProfileController::class);
15+
return $this->redirectToRoute('profile');
1616
}
1717
}

src/Controller/User/Admin/AddUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __invoke(
3333
$translator->trans('User successfully added.')
3434
);
3535

36-
return $this->redirectToRoute(OverviewController::class);
36+
return $this->redirectToRoute('user_overview');
3737
}
3838

3939
return $this->render('user/admin/add.html.twig', [

src/Controller/User/Admin/DisableUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public function __invoke(
2525
$translator->trans('User successfully disabled.')
2626
);
2727

28-
return $this->redirectToRoute(OverviewController::class);
28+
return $this->redirectToRoute('user_overview');
2929
}
3030
}

src/Controller/User/Admin/EditUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __invoke(
3535
$translator->trans('User successfully edited.')
3636
);
3737

38-
return $this->redirectToRoute(OverviewController::class);
38+
return $this->redirectToRoute('user_overview');
3939
}
4040

4141
return $this->render('user/admin/edit.html.twig', [

src/Controller/User/Admin/EnableUserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public function __invoke(
2525
$translator->trans('User successfully enabled.')
2626
);
2727

28-
return $this->redirectToRoute(OverviewController::class);
28+
return $this->redirectToRoute('user_overview');
2929
}
3030
}

src/Controller/User/Admin/RequestConfirmationController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public function __invoke(
2424
$translator->trans('User is already confirmed.')
2525
);
2626

27-
$this->redirectToRoute(EditUserController::class, ['user' => $user->getId()]);
27+
$this->redirectToRoute('user_edit', ['user' => $user->getId()]);
2828
}
2929

3030
$bus->dispatch(new SendConfirmation($user));
@@ -34,6 +34,6 @@ public function __invoke(
3434
$translator->trans('Confirmation mail successfully sent')
3535
);
3636

37-
return $this->redirectToRoute(EditUserController::class, ['user' => $user->getId()]);
37+
return $this->redirectToRoute('user_edit', ['user' => $user->getId()]);
3838
}
3939
}

src/Controller/User/Ajax/PasswordStrengthController.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
use Symfony\Component\HttpFoundation\Request;
77
use Symfony\Component\HttpFoundation\Response;
88
use SumoCoders\FrameworkCoreBundle\Security\PasswordStrengthService;
9+
use Symfony\Component\Routing\Attribute\Route;
910

11+
#[Route('/admin/users/ajax/password-strength', name: 'admin_user_ajax_password_strength')]
1012
class PasswordStrengthController extends AbstractController
1113
{
1214
public function __invoke(
@@ -16,7 +18,7 @@ public function __invoke(
1618
$password = json_decode($request->getContent(), true)['password'] ?? '';
1719

1820
return $this->json([
19-
'strength' => $passwordStrengthService->estimateStrength($password),
21+
'strength' => $passwordStrengthService->estimateStrength($password),
2022
]);
2123
}
2224
}

src/Controller/User/ConfirmController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __invoke(
3131
$translator->trans('It looks like you clicked on an invalid account activation link. Please try again.')
3232
);
3333

34-
return $this->redirectToRoute(LoginController::class);
34+
return $this->redirectToRoute('login');
3535
}
3636

3737
$confirmForm = $this->createForm(ConfirmType::class, new ConfirmUser($user));
@@ -51,12 +51,12 @@ public function __invoke(
5151
*/
5252
if ($user->getPasswordResetToken() !== null) {
5353
return $this->redirectToRoute(
54-
ResetPasswordController::class,
54+
'reset_password',
5555
['token' => $user->getPasswordResetToken()]
5656
);
5757
}
5858

59-
return $this->redirectToRoute(LoginController::class);
59+
return $this->redirectToRoute('login');
6060
}
6161

6262
return $this->render('user/confirm.html.twig', [

0 commit comments

Comments
 (0)