Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit 765ebe5

Browse files
committed
Require at least one char for apiKey
1 parent e7b88f5 commit 765ebe5

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

paperspace/cli/auth.py

+1
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,5 @@ def logout():
4444
@click.argument("api_key", required=False, callback=common.prompt_for_secret("Enter your API Key: "))
4545
def save_api_key(api_key):
4646
command = login_commands.SetApiKeyCommand()
47+
api_key = api_key.strip()
4748
command.execute(api_key)

paperspace/commands/login.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ def execute(self):
1919
self.logger.log(version)
2020

2121

22-
class SetApiKeyCommand(object):
22+
class SetApiKeyCommand(CommandBase):
2323
def execute(self, api_key):
24+
if not api_key:
25+
self.logger.error("API Key cannot be empty.")
26+
return
27+
2428
set_apikey(api_key)

paperspace/login.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def set_apikey(apikey):
125125
json.dump(config_data, outfile, indent=2, sort_keys=True)
126126
outfile.write('\n')
127127

128-
logger.log("Successfully added API Key to {}. You're ready to go!".format(config_path))
128+
logger.log("Successfully added your API Key to {}. You're ready to go!".format(config_path))
129129

130130
return True
131131

0 commit comments

Comments
 (0)