Creates a new `LOGIN` command.
(
service: Rc<RefCell<dyn Service>>,
console: Rc<RefCell<dyn Console>>,
storage: Rc<RefCell<Storage>>,
)
| 58 | impl LoginCommand { |
| 59 | /// Creates a new `LOGIN` command. |
| 60 | pub fn new( |
| 61 | service: Rc<RefCell<dyn Service>>, |
| 62 | console: Rc<RefCell<dyn Console>>, |
| 63 | storage: Rc<RefCell<Storage>>, |
| 64 | ) -> Rc<Self> { |
| 65 | Rc::from(Self { |
| 66 | metadata: CallableMetadataBuilder::new("LOGIN") |
| 67 | .with_async(true) |
| 68 | .with_syntax(&[ |
| 69 | ( |
| 70 | &[SingularArgSyntax::RequiredValue( |
| 71 | RequiredValueSyntax { |
| 72 | name: Cow::Borrowed("username"), |
| 73 | vtype: ExprType::Text, |
| 74 | }, |
| 75 | ArgSepSyntax::End, |
| 76 | )], |
| 77 | None, |
| 78 | ), |
| 79 | ( |
| 80 | &[ |
| 81 | SingularArgSyntax::RequiredValue( |
| 82 | RequiredValueSyntax { |
| 83 | name: Cow::Borrowed("username"), |
| 84 | vtype: ExprType::Text, |
| 85 | }, |
| 86 | ArgSepSyntax::Exactly(ArgSep::Long), |
| 87 | ), |
| 88 | SingularArgSyntax::RequiredValue( |
| 89 | RequiredValueSyntax { |
| 90 | name: Cow::Borrowed("password"), |
| 91 | vtype: ExprType::Text, |
| 92 | }, |
| 93 | ArgSepSyntax::End, |
| 94 | ), |
| 95 | ], |
| 96 | None, |
| 97 | ), |
| 98 | ]) |
| 99 | .with_category(CATEGORY) |
| 100 | .with_description( |
| 101 | "Logs into the user's account. |
| 102 | On a successful login, this mounts your personal drive under the CLOUD:/ location, which you can \ |
| 103 | access with any other file-related commands. Using the cloud:// file system scheme, you can mount \ |
| 104 | other people's drives with the MOUNT command. |
| 105 | To create an account, use the SIGNUP command.", |
| 106 | ) |
| 107 | .build(), |
| 108 | service, |
| 109 | console, |
| 110 | storage, |
| 111 | }) |
| 112 | } |
| 113 | |
| 114 | /// Performs the login workflow against the server. |
| 115 | async fn do_login(&self, username: &str, password: &str) -> io::Result<()> { |
nothing calls this directly
no test coverage detected