File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -485,12 +485,25 @@ impl system_notifier::Server for SystemNotifier {
485485 mut results : system_notifier:: AddAccountResults ,
486486 ) -> capnp:: capability:: Promise < ( ) , capnp:: Error > {
487487 let keyring = self . env . keyring . clone ( ) ;
488+ let http = self . env . http . clone ( ) ;
488489 Promise :: from_future ( async move {
489490 let account = params. get ( ) ?. get_account ( ) ?;
490491 let username = account. get_username ( ) ?. to_str ( ) ?;
491492 let server = account. get_server ( ) ?. to_str ( ) ?;
492493 let password = params. get ( ) ?. get_password ( ) ?. to_str ( ) ?;
493494
495+ info ! ( "validating account" ) ;
496+ let url = models:: Subscription :: build_url ( server, "stats" , 0 )
497+ . map_err ( |e| capnp:: Error :: failed ( e. to_string ( ) ) ) ?;
498+
499+ http. get ( url)
500+ . basic_auth ( username, Some ( password) )
501+ . send ( )
502+ . await
503+ . map_err ( |e| capnp:: Error :: failed ( e. to_string ( ) ) ) ?
504+ . error_for_status ( )
505+ . map_err ( |e| capnp:: Error :: failed ( e. to_string ( ) ) ) ?;
506+
494507 let attrs = HashMap :: from ( [
495508 ( "type" , "password" ) ,
496509 ( "username" , username) ,
You can’t perform that action at this time.
0 commit comments