Skip to content

Commit 0fc317f

Browse files
committed
Internal: Fix typo in new field naming for password rotation - refs #6460
1 parent 9448f0c commit 0fc317f

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/CoreBundle/Controller/AccountController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function edit(
7777
$password = $form['password']->getData();
7878
if ($password) {
7979
$user->setPlainPassword($password);
80-
$user->setPasswordUpdateAt(new \DateTimeImmutable());
80+
$user->setPasswordUpdatedAt(new \DateTimeImmutable());
8181
}
8282
}
8383

@@ -224,7 +224,7 @@ public function changePassword(
224224
));
225225
} else {
226226
$user->setPlainPassword($newPassword);
227-
$user->setPasswordUpdateAt(new \DateTimeImmutable());
227+
$user->setPasswordUpdatedAt(new \DateTimeImmutable());
228228
$userRepository->updateUser($user);
229229
$this->addFlash('success', 'Password updated successfully.');
230230

src/CoreBundle/Controller/SecurityController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function loginJson(
148148
// Password rotation check
149149
$days = (int) $this->settingsManager->getSetting('security.password_rotation_days', true);
150150
if ($days > 0) {
151-
$lastUpdate = $user->getPasswordUpdateAt() ?? $user->getCreatedAt();
151+
$lastUpdate = $user->getPasswordUpdatedAt() ?? $user->getCreatedAt();
152152
$diffDays = (new \DateTimeImmutable())->diff($lastUpdate)->days;
153153

154154
if ($diffDays > $days) {

src/CoreBundle/Entity/User.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ class User implements UserInterface, EquatableInterface, ResourceInterface, Reso
739739

740740
#[Groups(['user:read', 'user:write'])]
741741
#[ORM\Column(name: 'password_update_at', type: 'datetime', nullable: true)]
742-
protected ?\DateTimeInterface $passwordUpdateAt = null;
742+
protected ?\DateTimeInterface $passwordUpdatedAt = null;
743743

744744
public function __construct()
745745
{
@@ -2597,19 +2597,19 @@ public function setMfaLastUsed(?DateTimeInterface $mfaLastUsed): self
25972597
/**
25982598
* @return \DateTimeInterface|null
25992599
*/
2600-
public function getPasswordUpdateAt(): ?\DateTimeInterface
2600+
public function getPasswordUpdatedAt(): ?\DateTimeInterface
26012601
{
2602-
return $this->passwordUpdateAt;
2602+
return $this->passwordUpdatedAt;
26032603
}
26042604

26052605
/**
26062606
* @param \DateTimeInterface|null $date
26072607
*
26082608
* @return $this
26092609
*/
2610-
public function setPasswordUpdateAt(?\DateTimeInterface $date): self
2610+
public function setPasswordUpdatedAt(?\DateTimeInterface $date): self
26112611
{
2612-
$this->passwordUpdateAt = $date;
2612+
$this->passwordUpdatedAt = $date;
26132613
return $this;
26142614
}
26152615
}

src/CoreBundle/Migrations/Schema/V200/Version20250711143900.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ final class Version20250711143900 extends AbstractMigrationChamilo
1313
{
1414
public function getDescription(): string
1515
{
16-
return 'Add password_rotation_days setting and user.password_update_at column; migrate existing extra-field data and remove old extra-field';
16+
return 'Add password_rotation_days setting and user.password_updated_at column; migrate existing extra-field data and remove old extra-field';
1717
}
1818

1919
public function up(Schema $schema): void
2020
{
2121
// 1. Add new column to user table
22-
$this->addSql("ALTER TABLE `user` ADD COLUMN `password_update_at` DATETIME DEFAULT NULL;");
22+
$this->addSql("ALTER TABLE `user` ADD COLUMN `password_updated_at` DATETIME DEFAULT NULL;");
2323

2424
// 2. Insert or update the new setting in settings table
2525
$setting = [
@@ -74,15 +74,15 @@ public function up(Schema $schema): void
7474

7575
// 3. Migrate existing extra-field data into the new column (if tables exist)
7676
if ($schema->hasTable('extra_field_values') && $schema->hasTable('extra_field')) {
77-
// Copy field_value into user.password_update_at for variable 'password_updated_at'
77+
// Copy field_value into user.password_updated_at for variable 'password_updated_at'
7878
$this->addSql("
7979
UPDATE `user` AS u
8080
INNER JOIN `extra_field_values` AS efv
8181
ON efv.item_id = u.id
8282
INNER JOIN `extra_field` AS ef
8383
ON ef.id = efv.field_id
8484
AND ef.variable = 'password_updated_at'
85-
SET u.password_update_at = efv.field_value
85+
SET u.password_updated_at = efv.field_value
8686
");
8787

8888
// Delete the old extra_field_values entries
@@ -115,6 +115,6 @@ public function down(Schema $schema): void
115115
");
116116

117117
// 2. Drop the column from user table
118-
$this->addSql("ALTER TABLE `user` DROP COLUMN `password_update_at`;");
118+
$this->addSql("ALTER TABLE `user` DROP COLUMN `password_updated_at`;");
119119
}
120120
}

0 commit comments

Comments
 (0)