Skip to content

Commit 8a4f658

Browse files
author
Nicolas Rebagliati
committed
Merge branch 'tkt_64_check_auth_on_start' into 'dev'
Tkt 64 check auth on start Closes #64 See merge request faradaysec/faraday-cli!66
2 parents 424099e + a12129f commit 8a4f658

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
exclude: docs/mkdocs.yml
1111
- id: debug-statements
1212
- repo: https://github.com/psf/black
13-
rev: 21.6b0
13+
rev: 22.3.0
1414
hooks:
1515
- id: black
1616
language_version: python3
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Check if token is valid on start in shell mode

faraday_cli/shell/shell.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,20 @@ def __init__(self, *args, **kwargs):
105105
ignore_ssl=active_config.ignore_ssl,
106106
token=active_config.token,
107107
)
108+
if not self.api_client.is_token_valid():
109+
intro.append(
110+
style(
111+
f"{self.emojis['cross']} Authentication invalid, run 'auth'",
112+
fg=COLORS.RED,
113+
)
114+
)
108115
else:
109116
self.api_client = FaradayApi()
110117
intro.append(
111-
style("Missing faraday server, run 'auth'", fg=COLORS.YELLOW)
118+
style(
119+
"Missing faraday authentication, run 'auth'",
120+
fg=COLORS.YELLOW,
121+
)
112122
)
113123
self.custom_plugins_path = active_config.custom_plugins_path
114124
self.ignore_info_severity = active_config.ignore_info_severity

0 commit comments

Comments
 (0)