Performs the login workflow against the server.
(&self, username: &str, password: &str)
| 113 | |
| 114 | /// Performs the login workflow against the server. |
| 115 | async fn do_login(&self, username: &str, password: &str) -> io::Result<()> { |
| 116 | let response = self.service.borrow_mut().login(username, password).await?; |
| 117 | |
| 118 | { |
| 119 | let console = &mut *self.console.borrow_mut(); |
| 120 | if !is_narrow(&*console) && !response.motd.is_empty() { |
| 121 | console.print("")?; |
| 122 | console.print("----- BEGIN SERVER MOTD -----")?; |
| 123 | for line in response.motd { |
| 124 | refill_and_print(console, [line], "")?; |
| 125 | } |
| 126 | console.print("----- END SERVER MOTD -----")?; |
| 127 | console.print("")?; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | let mut storage = self.storage.borrow_mut(); |
| 132 | storage.mount("CLOUD", &format!("cloud://{}", username))?; |
| 133 | |
| 134 | Ok(()) |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | #[async_trait(?Send)] |