feat(credential): allow to add credential

This commit is contained in:
grimhilt
2024-02-20 21:24:22 +01:00
parent 1c60560c6e
commit 6a11bb494b
6 changed files with 139 additions and 8 deletions

View File

@@ -28,7 +28,11 @@ impl ApiCall for Login {
let url = match self.host.clone() {
Some(h) => {
let mut u = String::from("https://");
let mut u = if &h[0..8] == "https://" || &h[0..7] == "http://" {
String::new()
} else {
String::from("https://")
};
u.push_str(&h);
u.push_str("/ocs/v2.php/core/getapppassword");
u
@@ -53,6 +57,12 @@ impl Login {
self
}
pub fn set_auth(&mut self, username: &str, password: &str) -> &mut Login {
self.login = username.to_owned();
self.password = password.to_owned();
self
}
pub fn set_host(&mut self, host: Option<String>) -> &mut Login {
self.host = host;
self