-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import logging | ||
|
||
from keepercommander.auth import login_steps | ||
from keepercommander import api | ||
from keepercommander.__main__ import get_params_from_config | ||
|
||
|
||
class CustomUi(login_steps.LoginUi): | ||
def on_device_approval(self, step): | ||
try: | ||
step.send_push(login_steps.DeviceApprovalChannel.Email) | ||
except Exception as e: | ||
logging.error(e) | ||
verification_code = wait_for_verification_code() | ||
step.send_code(login_steps.DeviceApprovalChannel.Email, verification_code) | ||
|
||
def on_two_factor(self, step): | ||
raise NotImplementedError() | ||
|
||
def on_password(self, step): | ||
password = wait_for_password() | ||
try: | ||
step.verify_password(password) | ||
except Exception as e: | ||
logging.error(e) | ||
|
||
def on_sso_redirect(self, step): | ||
raise NotImplementedError() | ||
|
||
def on_sso_data_key(self, step): | ||
raise NotImplementedError() | ||
|
||
|
||
my_params = get_params_from_config('config.json') | ||
while not my_params.user: | ||
my_params.user = input('User(Email): ') | ||
|
||
ui = CustomUi() | ||
api.login(my_params, login_ui=ui) | ||
|
||
if not my_params.session_token: | ||
exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters