updated api to create totp struct, get totp secret directly if it exists
This commit is contained in:
parent
e70d035c86
commit
f891d2f940
4 changed files with 18 additions and 20 deletions
|
|
@ -50,7 +50,10 @@ impl User {
|
|||
)
|
||||
}
|
||||
|
||||
async fn get_by_id(conn: impl SqliteExecutor<'_>, id: &UserID) -> Result<Option<Self>, Error> {
|
||||
pub async fn get_by_id(
|
||||
conn: impl SqliteExecutor<'_>,
|
||||
id: &UserID,
|
||||
) -> Result<Option<Self>, Error> {
|
||||
Ok(DatabaseUsers::get_one_by_id(conn, &id.0)
|
||||
.await?
|
||||
.map(Self::from))
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ impl User {
|
|||
pub fn paper_key_hashed(&self) -> Option<&str> {
|
||||
self.paper_key.as_deref()
|
||||
}
|
||||
pub fn is_totp_enabled(&self) -> bool {
|
||||
self.totp_secret.is_some()
|
||||
pub fn totp_secret(&self) -> Option<Vec<u8>> {
|
||||
self.totp_secret.clone()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue