mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat: logout sessions on password change (#23188)
* log out ohter sessions on password change * translations * update and add tests * rename event to UserLogoutOtherSessions * fix typo * requested changes * fix tests * fix medium:test * use ValidateBoolean * fix format * dont delete current session id * Update server/src/dtos/auth.dto.ts Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> * rename event and invalidateOtherSessions * chore: cleanup --------- Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> Co-authored-by: Jason Rasmussen <jason@rasm.me>
This commit is contained in:
parent
6bb1a9e083
commit
382481735a
15 changed files with 90 additions and 19 deletions
|
|
@ -13,30 +13,36 @@ part of openapi.api;
|
|||
class ChangePasswordDto {
|
||||
/// Returns a new [ChangePasswordDto] instance.
|
||||
ChangePasswordDto({
|
||||
this.invalidateSessions = false,
|
||||
required this.newPassword,
|
||||
required this.password,
|
||||
});
|
||||
|
||||
bool invalidateSessions;
|
||||
|
||||
String newPassword;
|
||||
|
||||
String password;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ChangePasswordDto &&
|
||||
other.invalidateSessions == invalidateSessions &&
|
||||
other.newPassword == newPassword &&
|
||||
other.password == password;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(invalidateSessions.hashCode) +
|
||||
(newPassword.hashCode) +
|
||||
(password.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ChangePasswordDto[newPassword=$newPassword, password=$password]';
|
||||
String toString() => 'ChangePasswordDto[invalidateSessions=$invalidateSessions, newPassword=$newPassword, password=$password]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'invalidateSessions'] = this.invalidateSessions;
|
||||
json[r'newPassword'] = this.newPassword;
|
||||
json[r'password'] = this.password;
|
||||
return json;
|
||||
|
|
@ -51,6 +57,7 @@ class ChangePasswordDto {
|
|||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return ChangePasswordDto(
|
||||
invalidateSessions: mapValueOfType<bool>(json, r'invalidateSessions') ?? false,
|
||||
newPassword: mapValueOfType<String>(json, r'newPassword')!,
|
||||
password: mapValueOfType<String>(json, r'password')!,
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue