feat(credential): allow to add credential
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user