2021-04-21 05:41:48 +00:00
|
|
|
// pub async fn validator(
|
|
|
|
// req: ServiceRequest,
|
|
|
|
// credentials: BasicAuth,
|
|
|
|
// ) -> Result<ServiceRequest, Error> {
|
|
|
|
// println!("{}", credentials.user_id());
|
|
|
|
// println!("{:?}", credentials.password());
|
|
|
|
// // verify credentials from db
|
|
|
|
// let config = req.app_data::<AppConfig>().expect("Error getting config");
|
2020-05-09 06:37:08 +00:00
|
|
|
|
2021-04-21 05:41:48 +00:00
|
|
|
// let valid =
|
|
|
|
// web::block(move || validate_basic_auth(credentials, config)).await?;
|
|
|
|
// if valid {
|
|
|
|
// debug!("Success");
|
|
|
|
// Ok(req)
|
|
|
|
// } else {
|
|
|
|
// println!("blah");
|
|
|
|
// let err: Error = crate::errors::DomainError::new_password_error(
|
|
|
|
// "Wrong password or account does not exist".to_string(),
|
|
|
|
// )
|
|
|
|
// .into();
|
2020-08-11 19:51:20 +00:00
|
|
|
|
2021-04-21 05:41:48 +00:00
|
|
|
// Err(err)
|
|
|
|
// }
|
|
|
|
// }
|