@@ -138,10 +138,11 @@ pub struct EnteredLoginParam {
138138}
139139
140140impl EnteredLoginParam {
141- /// Loads entered account settings.
141+ /// Loads entered account settings
142+ /// that were set by the deprecated `configured_*` configs.
142143 ///
143- /// This is a legacy API for loading from separate config parameters .
144- pub ( crate ) async fn load ( context : & Context ) -> Result < Self > {
144+ /// This is only needed by tests and clients using the old CFFI API .
145+ pub ( crate ) async fn load_legacy ( context : & Context ) -> Result < Self > {
145146 let addr = context
146147 . get_config ( Config :: Addr )
147148 . await ?
@@ -241,7 +242,10 @@ impl EnteredLoginParam {
241242
242243 /// Saves entered account settings,
243244 /// so that they can be prefilled if the user wants to configure the server again.
244- pub ( crate ) async fn save ( & self , context : & Context ) -> Result < ( ) > {
245+ ///
246+ /// This is needed in case a UI is not yet updated, and still uses `get_config("mail_pw")` etc.
247+ /// in order to prefill the entered account settings.
248+ pub ( crate ) async fn save_legacy ( & self , context : & Context ) -> Result < ( ) > {
245249 context. set_config ( Config :: Addr , Some ( & self . addr ) ) . await ?;
246250
247251 context
@@ -364,7 +368,7 @@ mod tests {
364368 . await ?;
365369 t. set_config ( Config :: MailPw , Some ( "foobarbaz" ) ) . await ?;
366370
367- let param = EnteredLoginParam :: load ( t) . await ?;
371+ let param = EnteredLoginParam :: load_legacy ( t) . await ?;
368372 assert_eq ! ( param. addr, "alice@example.org" ) ;
369373 assert_eq ! (
370374 param. certificate_checks,
@@ -373,13 +377,13 @@ mod tests {
373377
374378 t. set_config ( Config :: ImapCertificateChecks , Some ( "1" ) )
375379 . await ?;
376- let param = EnteredLoginParam :: load ( t) . await ?;
380+ let param = EnteredLoginParam :: load_legacy ( t) . await ?;
377381 assert_eq ! ( param. certificate_checks, EnteredCertificateChecks :: Strict ) ;
378382
379383 // Fail to load invalid settings, but do not panic.
380384 t. set_config ( Config :: ImapCertificateChecks , Some ( "999" ) )
381385 . await ?;
382- assert ! ( EnteredLoginParam :: load ( t) . await . is_err( ) ) ;
386+ assert ! ( EnteredLoginParam :: load_legacy ( t) . await . is_err( ) ) ;
383387
384388 Ok ( ( ) )
385389 }
@@ -407,7 +411,7 @@ mod tests {
407411 certificate_checks : Default :: default ( ) ,
408412 oauth2 : false ,
409413 } ;
410- param. save ( & t) . await ?;
414+ param. save_legacy ( & t) . await ?;
411415 assert_eq ! (
412416 t. get_config( Config :: Addr ) . await ?. unwrap( ) ,
413417 "alice@example.org"
@@ -416,7 +420,7 @@ mod tests {
416420 assert_eq ! ( t. get_config( Config :: SendPw ) . await ?, None ) ;
417421 assert_eq ! ( t. get_config_int( Config :: SendPort ) . await ?, 2947 ) ;
418422
419- assert_eq ! ( EnteredLoginParam :: load ( & t) . await ?, param) ;
423+ assert_eq ! ( EnteredLoginParam :: load_legacy ( & t) . await ?, param) ;
420424
421425 Ok ( ( ) )
422426 }
0 commit comments