Can log actions in JSON format
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -31,28 +31,25 @@ fn hash_password<P: AsRef<[u8]>>(pwd: P) -> Res<String> {
|
||||
}
|
||||
|
||||
fn verify_password<P: AsRef<[u8]>>(pwd: P, hash: &str) -> bool {
|
||||
match bcrypt::verify(pwd, hash) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
log::warn!("Failed to verify password! {e:?}");
|
||||
false
|
||||
}
|
||||
}
|
||||
bcrypt::verify(pwd, hash).unwrap_or_else(|e| {
|
||||
log::warn!("Failed to verify password! {e:?}");
|
||||
false
|
||||
})
|
||||
}
|
||||
|
||||
impl UsersSyncBackend for EntityManager<User> {
|
||||
fn find_by_email(&self, u: &str) -> Res<Option<User>> {
|
||||
fn find_by_username_or_email(&self, u: &str) -> Res<Option<User>> {
|
||||
for entry in self.iter() {
|
||||
if entry.email.eq(u) {
|
||||
if entry.username.eq(u) || entry.email.eq(u) {
|
||||
return Ok(Some(entry.clone()));
|
||||
}
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
fn find_by_username_or_email(&self, u: &str) -> Res<Option<User>> {
|
||||
fn find_by_email(&self, u: &str) -> Res<Option<User>> {
|
||||
for entry in self.iter() {
|
||||
if entry.username.eq(u) || entry.email.eq(u) {
|
||||
if entry.email.eq(u) {
|
||||
return Ok(Some(entry.clone()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user