Formatting
This commit is contained in:
parent
c79efa1abc
commit
878bb3b180
3 changed files with 4 additions and 6 deletions
|
@ -45,7 +45,7 @@ impl From<PError> for IronError {
|
||||||
|
|
||||||
pub fn get_api_handler(collection: Arc<Mutex<Collection>>) -> Mount {
|
pub fn get_api_handler(collection: Arc<Mutex<Collection>>) -> Mount {
|
||||||
let mut api_handler = Mount::new();
|
let mut api_handler = Mount::new();
|
||||||
|
|
||||||
{
|
{
|
||||||
let collection = collection.clone();
|
let collection = collection.clone();
|
||||||
api_handler.mount("/auth/", move |request: &mut Request| {
|
api_handler.mount("/auth/", move |request: &mut Request| {
|
||||||
|
|
|
@ -291,7 +291,7 @@ impl Collection {
|
||||||
Some(n) => n,
|
Some(n) => n,
|
||||||
};
|
};
|
||||||
|
|
||||||
let user = User{
|
let user = User {
|
||||||
name: name.to_owned(),
|
name: name.to_owned(),
|
||||||
password: password.to_owned(),
|
password: password.to_owned(),
|
||||||
};
|
};
|
||||||
|
@ -343,7 +343,7 @@ impl Collection {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn auth(&self, username: &str, password: &str) -> bool {
|
pub fn auth(&self, username: &str, password: &str) -> bool {
|
||||||
self.users.iter().any(|u| u.name == username && u.password == password )
|
self.users.iter().any(|u| u.name == username && u.password == password)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn browse(&self, path: &Path) -> Result<Vec<CollectionFile>, PError> {
|
pub fn browse(&self, path: &Path) -> Result<Vec<CollectionFile>, PError> {
|
||||||
|
|
|
@ -78,9 +78,7 @@ impl fmt::Display for PError {
|
||||||
PError::ConfigFileOpenError => write!(f, "Could not open config file"),
|
PError::ConfigFileOpenError => write!(f, "Could not open config file"),
|
||||||
PError::ConfigFileReadError => write!(f, "Could not read config file"),
|
PError::ConfigFileReadError => write!(f, "Could not read config file"),
|
||||||
PError::ConfigFileParseError => write!(f, "Could not parse config file"),
|
PError::ConfigFileParseError => write!(f, "Could not parse config file"),
|
||||||
PError::ConfigUsersParseError => {
|
PError::ConfigUsersParseError => write!(f, "Could not parse users in config file"),
|
||||||
write!(f, "Could not parse users in config file")
|
|
||||||
}
|
|
||||||
PError::ConfigMountDirsParseError => {
|
PError::ConfigMountDirsParseError => {
|
||||||
write!(f, "Could not parse mount directories in config file")
|
write!(f, "Could not parse mount directories in config file")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue