mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 04:04:43 +08:00
feat(users): implement force set and force change password (#4564)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -20,6 +20,7 @@ pub struct User {
|
||||
pub created_at: PrimitiveDateTime,
|
||||
pub last_modified_at: PrimitiveDateTime,
|
||||
pub preferred_merchant_id: Option<String>,
|
||||
pub last_password_modified_at: Option<PrimitiveDateTime>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
@ -35,6 +36,7 @@ pub struct UserNew {
|
||||
pub created_at: Option<PrimitiveDateTime>,
|
||||
pub last_modified_at: Option<PrimitiveDateTime>,
|
||||
pub preferred_merchant_id: Option<String>,
|
||||
pub last_password_modified_at: Option<PrimitiveDateTime>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
|
||||
@ -45,6 +47,7 @@ pub struct UserUpdateInternal {
|
||||
is_verified: Option<bool>,
|
||||
last_modified_at: PrimitiveDateTime,
|
||||
preferred_merchant_id: Option<String>,
|
||||
last_password_modified_at: Option<PrimitiveDateTime>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -52,10 +55,12 @@ pub enum UserUpdate {
|
||||
VerifyUser,
|
||||
AccountUpdate {
|
||||
name: Option<String>,
|
||||
password: Option<Secret<String>>,
|
||||
is_verified: Option<bool>,
|
||||
preferred_merchant_id: Option<String>,
|
||||
},
|
||||
PasswordUpdate {
|
||||
password: Option<Secret<String>>,
|
||||
},
|
||||
}
|
||||
|
||||
impl From<UserUpdate> for UserUpdateInternal {
|
||||
@ -68,18 +73,27 @@ impl From<UserUpdate> for UserUpdateInternal {
|
||||
is_verified: Some(true),
|
||||
last_modified_at,
|
||||
preferred_merchant_id: None,
|
||||
last_password_modified_at: None,
|
||||
},
|
||||
UserUpdate::AccountUpdate {
|
||||
name,
|
||||
password,
|
||||
is_verified,
|
||||
preferred_merchant_id,
|
||||
} => Self {
|
||||
name,
|
||||
password,
|
||||
password: None,
|
||||
is_verified,
|
||||
last_modified_at,
|
||||
preferred_merchant_id,
|
||||
last_password_modified_at: None,
|
||||
},
|
||||
UserUpdate::PasswordUpdate { password } => Self {
|
||||
name: None,
|
||||
password,
|
||||
is_verified: None,
|
||||
last_modified_at,
|
||||
preferred_merchant_id: None,
|
||||
last_password_modified_at: Some(last_modified_at),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user