dialtone_sqlx 0.1.0

Dialtone SQLx Back-End
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::db::user_principal::update_auth::update_user_auth;
use crate::logic::user::auth::new_auth;
use sqlx::{Executor, Postgres};

pub async fn change_user_auth(
    exec: impl Executor<'_, Database = Postgres>,
    acct: &str,
    password: &str,
) -> anyhow::Result<bool> {
    let auth_data = new_auth(acct, password)?;
    let result = update_user_auth(exec, acct, auth_data).await?;
    match result {
        None => Ok(false),
        Some(_) => Ok(true),
    }
}