Skip to content

Commit

Permalink
add two_factor_id
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan0xC committed Dec 31, 2024
1 parent 930c62c commit 86a0d61
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/db/models/two_factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ db_object! {
#[diesel(table_name = twofactor)]
#[diesel(primary_key(uuid))]
pub struct TwoFactor {
pub uuid: String,
pub uuid: TwoFactorId,
pub user_uuid: UserId,
pub atype: i32,
pub enabled: bool,
Expand Down Expand Up @@ -44,7 +44,7 @@ pub enum TwoFactorType {
impl TwoFactor {
pub fn new(user_uuid: UserId, atype: TwoFactorType, data: String) -> Self {
Self {
uuid: crate::util::get_uuid(),
uuid: TwoFactorId(crate::util::get_uuid()),
user_uuid,
atype: atype as i32,
enabled: true,
Expand Down Expand Up @@ -218,3 +218,6 @@ impl TwoFactor {
Ok(())
}
}

#[derive(Clone, Debug, DieselNewType, FromForm, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct TwoFactorId(String);

0 comments on commit 86a0d61

Please sign in to comment.