Skip to content

Commit

Permalink
Merge branch 'development' into 'master'
Browse files Browse the repository at this point in the history
prepare release v 3.2.7

See merge request dadangnh/iam!301
  • Loading branch information
azhar2202 committed Jan 3, 2025
2 parents de06dd3 + 70a7186 commit f43ab8b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# IAM Changelog

## Version 3.2.6 (current stable)
## Version 3.2.7 (current stable)
* Updated Symfony Recipes
* update dependencies
* bug fix in endpoint change password by sikka

## Version 3.2.6
* Updated Symfony Recipes
* update dependencies
* bug fix in endpoint unit and kantor show all
Expand Down
2 changes: 1 addition & 1 deletion config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
api_platform:
title: IAM API Docs
version: 3.2.6
version: 3.2.7
description: |
Bug report and feature request are welcome, please report [here](https://gitlab.com/dadangnh/iam/-/issues).
Newest production version are always available at [https://iam.pajak.or.id/api](https://iam.pajak.or.id/api)
Expand Down
12 changes: 12 additions & 0 deletions src/Controller/SecurityController.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,21 @@ public function forceChangePassword(Request $request,

// TODO: check password strength and implement password blacklist
$newPasswordEncoded = $passwordHasher->hashPassword($user, $newPassword);
$dateTime = new \DateTime('now', new \DateTimeZone('Asia/Bangkok'));
$formattedDate = $dateTime->format('Y-m-d H:i:s');
// Update the user's password
$user->setPassword($newPasswordEncoded);
$this->entityManager->persist($user);
$this->entityManager->flush();

// Direct SQL update to set the lastchange field in GMT+7
$this->entityManager->getConnection()->executeStatement(
'UPDATE "user" SET last_change = :lastchange WHERE username = :username',
[
'lastchange' => $formattedDate, // Use the formatted date for lastchange
'username' => $username, // Use the username for the WHERE condition
]
);
return $this->json([
'code' => 200,
'message' => 'password successfully changed.'
Expand Down

0 comments on commit f43ab8b

Please sign in to comment.