Redact password hashes in debug output
This commit is contained in:
parent
35a68e46f7
commit
3ca9211e5d
@ -1,8 +1,10 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use crate::schema::*;
|
||||
use chrono::{DateTime, Local};
|
||||
use diesel::prelude::*;
|
||||
|
||||
#[derive(Queryable, Selectable, Debug, Clone)]
|
||||
#[derive(Queryable, Selectable, Clone)]
|
||||
#[diesel(table_name = users)]
|
||||
#[diesel(check_for_backend(diesel::sqlite::Sqlite))]
|
||||
pub struct User {
|
||||
@ -12,6 +14,17 @@ pub struct User {
|
||||
pub display_name: String,
|
||||
}
|
||||
|
||||
impl Debug for User {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("User")
|
||||
.field("id", &self.id)
|
||||
.field("username", &self.username)
|
||||
.field("pw_hash", &"<redacted>")
|
||||
.field("display_name", &self.display_name)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Insertable)]
|
||||
#[diesel(table_name = users)]
|
||||
pub struct NewUser<'a> {
|
||||
|
Loading…
Reference in New Issue
Block a user