From be6023b6020aec54563b9e7beea49c58787702af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Drwi=C4=99ga?= Date: Fri, 11 Nov 2016 17:56:52 +0100 Subject: [PATCH] Opening a browser --- parity/signer.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/parity/signer.rs b/parity/signer.rs index fd1258bf6..835cc397a 100644 --- a/parity/signer.rs +++ b/parity/signer.rs @@ -20,6 +20,7 @@ use std::path::PathBuf; use ansi_term::Colour; use io::{ForwardPanic, PanicHandler}; use util::path::restrict_permissions_owner; +use url; use rpc_apis; use ethcore_signer as signer; use helpers::replace_home; @@ -77,15 +78,16 @@ pub struct SignerCommand { pub fn execute(cmd: SignerCommand) -> Result { let code = try!(generate_new_token(cmd.path).map_err(|err| format!("Error generating token: {:?}", err))); - - let url = format!("http://{}:{}/#/auth?token={}", cmd.signer_interface, cmd.signer_port, code); + let auth_url = format!("http://{}:{}/#/auth?token={}", cmd.signer_interface, cmd.signer_port, code); + // Open a browser + url::open(&auth_url); + // And print in to the console Ok(format!( r#" Open: {} to authorize your browser. -Or use the code: {} - "#, - Colour::White.bold().paint(url), +Or use the code: {}"#, + Colour::White.bold().paint(auth_url), code )) }