Disable Sign In button while auth request is in flight to prevent multiple 2FA codes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
ee39e39e02
commit
9e6cdeb9c3
1 file changed
+10
-6
+10
-6
@@ -1186,23 +1186,27 @@ class AuthPage(Gtk.Box):
|
||||
tfa_card.pack_start(self.tfa_status, False, False, 0)
|
||||
self.pack_start(tfa_card, False, False, 0)
|
||||
|
||||
def _on_auth(self, _):
|
||||
def _on_auth(self, btn):
|
||||
btn.set_sensitive(False)
|
||||
btn.set_label("Signing in…")
|
||||
args = ["auth"]
|
||||
if self.sms_check.get_active():
|
||||
args.append("--force-sms")
|
||||
if self.debug_check.get_active():
|
||||
args.append("--debug")
|
||||
self.status_label.set_markup('<span fgcolor="#64a6e0">Connecting to Apple...</span>')
|
||||
self.status_label.set_markup('<span fgcolor="#64a6e0">Connecting to Apple — a code will be sent to your device…</span>')
|
||||
|
||||
def _worker():
|
||||
rc, out, err = icloudctl(*args)
|
||||
GLib.idle_add(self._auth_result, rc, out + err)
|
||||
GLib.idle_add(self._auth_result, rc, out + err, btn)
|
||||
threading.Thread(target=_worker, daemon=True).start()
|
||||
|
||||
def _auth_result(self, rc, output):
|
||||
if "two-factor" in output.lower() or "verification" in output.lower() or "2fa" in output.lower():
|
||||
def _auth_result(self, rc, output, btn):
|
||||
btn.set_sensitive(True)
|
||||
btn.set_label("Sign in with Apple ID")
|
||||
if "two-factor" in output.lower() or "verification" in output.lower() or "2fa" in output.lower() or "enter" in output.lower():
|
||||
self.status_label.set_markup(
|
||||
'<span fgcolor="#e6a020">A code was sent to your Apple device — enter it below.</span>'
|
||||
'<span fgcolor="#e6a020">Code sent — enter it in the box below.</span>'
|
||||
)
|
||||
self.tfa_entry.grab_focus()
|
||||
elif rc == 0:
|
||||
|
||||
Reference in new issue
Block a user