added anyhow, improve hamburger menu, improve dw articles
This commit is contained in:
@@ -16,14 +16,14 @@ pub struct NewUser {
|
||||
}
|
||||
|
||||
impl NewUser {
|
||||
pub fn new(username: String, email: String, password: String) -> NewUser {
|
||||
let hashed_password: String = hash(password.as_str(), DEFAULT_COST).unwrap();
|
||||
pub fn new(username: String, email: String, password: String) -> anyhow::Result<NewUser> {
|
||||
let hashed_password: String = hash(password.as_str(), DEFAULT_COST)?;
|
||||
let uuid = Uuid::new_v4();
|
||||
NewUser {
|
||||
Ok(NewUser {
|
||||
username,
|
||||
email,
|
||||
password: hashed_password,
|
||||
unique_id: uuid.to_string(),
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ pub struct User {
|
||||
}
|
||||
|
||||
impl User {
|
||||
pub fn verify(self, password: String) -> bool {
|
||||
verify(password.as_str(), &self.password).unwrap()
|
||||
pub fn verify(self, password: String) -> anyhow::Result<bool> {
|
||||
Ok(verify(password.as_str(), &self.password)?)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user