This repository was archived by the owner on Jun 12, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ void Auth::authenticate() {
3030 } else {
3131 string err;
3232
33+ Env::instance ()->delete_defaults ();
3334 Env::instance ()->write_credentials (Json::parse (oauth.body , err));
3435 Env::instance ()->load_credentials ();
3536
Original file line number Diff line number Diff line change @@ -121,6 +121,12 @@ void Env::write_default_org(std::string org_name) {
121121 FileManager::write (paths.defaults , str);
122122}
123123
124+ void Env::delete_defaults () {
125+ if (FileManager::file_exists (paths.defaults )){
126+ FileManager::delete_file (paths.defaults );
127+ }
128+ }
129+
124130void Env::verify_auth () {
125131 if (Env::instance ()->authenticated () == false ) {
126132 Auth::authenticate ();
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ class Env {
4141 bool load_defaults ();
4242 void write_credentials (json11::Json object);
4343 void write_default_org (std::string org_name);
44+ void delete_defaults ();
4445 void verify_auth ();
4546
4647private:
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ void Organization::set_default(std::string org_name) {
2525 std::string error_message = json[" error" ].string_value ();
2626
2727 if (error_message.size () > 0 ) {
28- console::error (" There was an error listing your organizations : " + error_message + " \n " );
28+ console::error (" There was an error setting your default organization : " + error_message + " \n " );
2929 } else {
3030 Env::instance ()->write_default_org (org_name);
3131 console::info (org_name + " is now your default organization" );
You can’t perform that action at this time.
0 commit comments