support magic link login (#3702)
This commit is contained in:
@@ -21,6 +21,7 @@ class ActionType(StrEnum):
|
||||
EXTRACT = "extract"
|
||||
VERIFICATION_CODE = "verification_code"
|
||||
|
||||
GOTO_URL = "goto_url"
|
||||
SCROLL = "scroll"
|
||||
KEYPRESS = "keypress"
|
||||
MOVE = "move"
|
||||
|
||||
@@ -260,6 +260,11 @@ class KeypressAction(Action):
|
||||
duration: int = 0
|
||||
|
||||
|
||||
class GotoUrlAction(Action):
|
||||
action_type: ActionType = ActionType.GOTO_URL
|
||||
url: str
|
||||
|
||||
|
||||
class MoveAction(Action):
|
||||
action_type: ActionType = ActionType.MOVE
|
||||
x: int
|
||||
|
||||
@@ -2153,6 +2153,18 @@ async def handle_left_mouse_action(
|
||||
return [ActionSuccess()]
|
||||
|
||||
|
||||
@TraceManager.traced_async(ignore_inputs=["scraped_page", "page"])
|
||||
async def handle_goto_url_action(
|
||||
action: actions.GotoUrlAction,
|
||||
page: Page,
|
||||
scraped_page: ScrapedPage,
|
||||
task: Task,
|
||||
step: Step,
|
||||
) -> list[ActionResult]:
|
||||
await page.goto(action.url, timeout=settings.BROWSER_LOADING_TIMEOUT_MS)
|
||||
return [ActionSuccess()]
|
||||
|
||||
|
||||
ActionHandler.register_action_type(ActionType.SOLVE_CAPTCHA, handle_solve_captcha_action)
|
||||
ActionHandler.register_action_type(ActionType.CLICK, handle_click_action)
|
||||
ActionHandler.register_action_type(ActionType.INPUT_TEXT, handle_input_text_action)
|
||||
@@ -2170,6 +2182,7 @@ ActionHandler.register_action_type(ActionType.MOVE, handle_move_action)
|
||||
ActionHandler.register_action_type(ActionType.DRAG, handle_drag_action)
|
||||
ActionHandler.register_action_type(ActionType.VERIFICATION_CODE, handle_verification_code_action)
|
||||
ActionHandler.register_action_type(ActionType.LEFT_MOUSE, handle_left_mouse_action)
|
||||
ActionHandler.register_action_type(ActionType.GOTO_URL, handle_goto_url_action)
|
||||
|
||||
|
||||
async def get_actual_value_of_parameter_if_secret(task: Task, parameter: str) -> Any:
|
||||
|
||||
@@ -7,13 +7,14 @@ from openai.types.responses.response import Response as OpenAIResponse
|
||||
from pydantic import ValidationError
|
||||
|
||||
from skyvern.constants import SCROLL_AMOUNT_MULTIPLIER
|
||||
from skyvern.core.totp import poll_verification_code
|
||||
from skyvern.exceptions import FailedToGetTOTPVerificationCode, NoTOTPVerificationCodeFound, UnsupportedActionType
|
||||
from skyvern.forge import app
|
||||
from skyvern.forge.prompts import prompt_engine
|
||||
from skyvern.forge.sdk.core import skyvern_context
|
||||
from skyvern.forge.sdk.models import Step
|
||||
from skyvern.forge.sdk.schemas.tasks import Task
|
||||
from skyvern.forge.sdk.schemas.totp_codes import OTPType
|
||||
from skyvern.services.otp_service import poll_otp_value
|
||||
from skyvern.utils.image_resizer import Resolution, scale_coordinates
|
||||
from skyvern.webeye.actions.action_types import ActionType
|
||||
from skyvern.webeye.actions.actions import (
|
||||
@@ -809,13 +810,16 @@ async def generate_cua_fallback_actions(
|
||||
totp_identifier=task.totp_identifier,
|
||||
)
|
||||
try:
|
||||
verification_code = await poll_verification_code(
|
||||
otp_value = await poll_otp_value(
|
||||
organization_id=task.organization_id,
|
||||
task_id=task.task_id,
|
||||
workflow_run_id=task.workflow_run_id,
|
||||
totp_verification_url=task.totp_verification_url,
|
||||
totp_identifier=task.totp_identifier,
|
||||
)
|
||||
if not otp_value or otp_value.get_otp_type() != OTPType.TOTP:
|
||||
raise NoTOTPVerificationCodeFound()
|
||||
verification_code = otp_value.value
|
||||
reasoning = reasoning or f"Received verification code: {verification_code}"
|
||||
action = VerificationCodeAction(
|
||||
verification_code=verification_code,
|
||||
|
||||
Reference in New Issue
Block a user