Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion gitfive/lib/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path
from time import sleep
from datetime import datetime
import re

from rich.console import Console
from rich import print as rprint
Expand Down Expand Up @@ -307,7 +308,11 @@ async def login(self, force=False):
req = await self._as_client.get("https://github.com/sessions/two-factor/app")
body = bs(req.text, 'html.parser')
authenticity_token = body.find("form", {"action": "/sessions/two-factor"}).find("input", {"name": "authenticity_token"}).attrs["value"]
msg = body.find("form", {"action": "/sessions/two-factor"}).find("div", {"class": "mt-3"}).text.strip().split("\n")[0]
twofa_form = body.find("form", attrs={"action": re.compile(r"/sessions/two-factor")})
if not twofa_form:
twofa_form = body.find("form", id=re.compile(r"two-factor", re.I))
msg = (twofa_form.get_text(" ", strip=True) if twofa_form else "Two-factor challenge")

rprint(f'[bold]🗨️ Github :[/bold] [italic]"{msg}"')
otp = pwinput("📱 Code => ")
data = {
Expand Down