Fix authenticated track insertion

This commit is contained in:
D. Scott Boggs 2023-06-27 14:20:43 -04:00
parent 205a3b165e
commit d7285a84bb
3 changed files with 58 additions and 41 deletions

View file

@ -65,8 +65,11 @@ impl ActiveModel {
impl Model {
pub fn check_password(
self,
password: impl AsRef<[u8]>,
) -> std::result::Result<Self, Either<Status, ErrorResponder>> {
match verify(password, &self.password_hash) {
Ok(true) => Ok(self),
Ok(false) => Err(Left(Status::Unauthorized)),
Err(err) => Err(Right(Error::from(err).into())),
}
}