Skip to content

Commit

Permalink
Merge branch 'tkt_64_check_auth_on_start' into 'dev'
Browse files Browse the repository at this point in the history
Tkt 64 check auth on start

Closes #64

See merge request faradaysec/faraday-cli!66
  • Loading branch information
Nicolas Rebagliati committed May 23, 2022
2 parents 424099e + a12129f commit 8a4f658
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
exclude: docs/mkdocs.yml
- id: debug-statements
- repo: https://github.com/psf/black
rev: 21.6b0
rev: 22.3.0
hooks:
- id: black
language_version: python3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG/current/check_auth_on_start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Check if token is valid on start in shell mode
12 changes: 11 additions & 1 deletion faraday_cli/shell/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,20 @@ def __init__(self, *args, **kwargs):
ignore_ssl=active_config.ignore_ssl,
token=active_config.token,
)
if not self.api_client.is_token_valid():
intro.append(
style(
f"{self.emojis['cross']} Authentication invalid, run 'auth'",
fg=COLORS.RED,
)
)
else:
self.api_client = FaradayApi()
intro.append(
style("Missing faraday server, run 'auth'", fg=COLORS.YELLOW)
style(
"Missing faraday authentication, run 'auth'",
fg=COLORS.YELLOW,
)
)
self.custom_plugins_path = active_config.custom_plugins_path
self.ignore_info_severity = active_config.ignore_info_severity
Expand Down

0 comments on commit 8a4f658

Please sign in to comment.