Changeset 1186:beb5a473fd54
- Timestamp:
- 04/30/25 15:05:57 (8 hours ago)
- Branch:
- python3
- Phase:
- public
- Tags:
- tip
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
locale/en/mlx.po
r1167 r1186 916 916 "the password is stored as text, and anybody who can access " 917 917 "your files will be able to read it." 918 919 msgid "simbrief_mfa_code_title" 920 msgstr "Enter MFA code" 921 922 msgid "simbrief_mfa_code_needed" 923 msgstr "" 924 "An MFA code is sent by Navigraph to your\n" 925 "e-mail address to complete the login.\n" 926 "Check your e-mail for the code and enter it below." 927 928 msgid "simbrief_mfa_code" 929 msgstr "MFA code:" 930 931 msgid "simbrief_mfa_code_tooltip" 932 msgstr "Enter the code received by e-mail." 918 933 919 934 msgid "simbrief_extra_fuel" -
locale/hu/mlx.po
r1167 r1186 915 915 "mindig újból beírnod. Vedd azonban figyelembe, hogy a jelszót szövegként " 916 916 "tároljuk, ezért bárki elolvashatja, aki hozzáfér a fájljaidhoz." 917 918 msgid "simbrief_mfa_code_title" 919 msgstr "2FA kód bírása" 920 921 msgid "simbrief_mfa_code_needed" 922 msgstr "" 923 "A Navigraph egy, a kétlépcsős azonosításhoz szükséges\n" 924 "kódot küldött az e-mail címedre a belépéshez.\n" 925 "Keresd meg a kódot a leveleid között és írd be." 926 927 msgid "simbrief_mfa_code" 928 msgstr "2FA kód:" 929 930 msgid "simbrief_mfa_code_tooltip" 931 msgstr "Írd be az e-mailben kapott kódot." 917 932 918 933 msgid "simbrief_extra_fuel" -
src/mlx/gui/cef.py
r1111 r1186 57 57 SIMBRIEF_RESULT_ERROR_LOGIN_FAILED = 13 58 58 59 #----------------------------------------------------------------------------- 60 61 class SimBriefMFACodeDialog(Gtk.Dialog): 62 """A dialog window to ask for the SimBrief (Navigraph) MFA code.""" 63 def __init__(self, gui): 64 """Construct the dialog.""" 65 super(SimBriefMFACodeDialog, self).__init__(WINDOW_TITLE_BASE + " - " + 66 xstr("simbrief_mfa_code_title"), 67 gui.mainWindow, 68 Gtk.DialogFlags.MODAL) 69 self.add_button(xstr("button_cancel"), Gtk.ResponseType.CANCEL) 70 self.add_button(xstr("button_ok"), Gtk.ResponseType.OK) 71 72 contentArea = self.get_content_area() 73 74 contentAlignment = Gtk.Alignment(xalign = 0.5, yalign = 0.5, 75 xscale = 0.0, yscale = 0.0) 76 contentAlignment.set_padding(padding_top = 4, padding_bottom = 16, 77 padding_left = 8, padding_right = 8) 78 79 contentArea.pack_start(contentAlignment, False, False, 0) 80 81 contentVBox = Gtk.VBox() 82 contentAlignment.add(contentVBox) 83 84 label = Gtk.Label(xstr("simbrief_mfa_code_needed")) 85 label.set_line_wrap(True) 86 label.set_justify(Gtk.Justification.CENTER) 87 label.set_alignment(0.5, 0.0) 88 89 contentVBox.pack_start(label, False, False, 0) 90 91 tableAlignment = Gtk.Alignment(xalign = 0.5, yalign = 0.5, 92 xscale = 0.0, yscale = 0.0) 93 tableAlignment.set_padding(padding_top = 24, padding_bottom = 0, 94 padding_left = 0, padding_right = 0) 95 96 table = Gtk.Table(1, 2) 97 table.set_row_spacings(4) 98 table.set_col_spacings(16) 99 table.set_homogeneous(False) 100 101 tableAlignment.add(table) 102 contentVBox.pack_start(tableAlignment, True, True, 0) 103 104 label = Gtk.Label(xstr("simbrief_mfa_code")) 105 label.set_use_underline(True) 106 label.set_alignment(0.0, 0.5) 107 table.attach(label, 0, 1, 0, 1) 108 109 self._mfaCode = Gtk.Entry() 110 self._mfaCode.set_width_chars(16) 111 self._mfaCode.set_tooltip_text(xstr("simbrief_mfa_code_tooltip")) 112 table.attach(self._mfaCode, 1, 2, 0, 1) 113 label.set_mnemonic_widget(self._mfaCode) 114 115 116 @property 117 def mfaCode(self): 118 """Get the MFA code entered.""" 119 return self._mfaCode.get_text() 120 121 def run(self): 122 """Run the dialog.""" 123 self.show_all() 124 125 response = super(SimBriefMFACodeDialog, self).run() 126 127 self.hide() 128 129 return response 130 59 131 #------------------------------------------------------------------------------ 60 132 … … 82 154 83 155 84 def __init__(self ):156 def __init__(self, gui): 85 157 """Construct the handler.""" 86 158 self._browser = None … … 92 164 self._lastProgress = SIMBRIEF_PROGRESS_SEARCHING_BROWSER 93 165 self._timeoutID = None 166 self._gui = gui 94 167 95 168 def initialize(self): … … 155 228 js +="form.submit();" 156 229 frame.ExecuteJavascript(js) 230 elif url.startswith("https://identity.api.navigraph.com//mfaEmail"): 231 dialog = SimBriefMFACodeDialog(self._gui) 232 response = dialog.run() 233 234 if response!=Gtk.ResponseType.OK: 235 self._updateProgress(SIMBRIEF_PROGRESS_WAITING_LOGIN, 236 SIMBRIEF_RESULT_ERROR_LOGIN_FAILED, None) 237 return 238 239 mfaCode = dialog.mfaCode 240 js = "form=document.getElementById(\"form1\");" 241 js +="form.txtcdvl.value=\"" + mfaCode + "\";" 242 js +="form.btnApprove.click();" 243 frame.ExecuteJavascript(js) 244 elif url.startswith("https://identity.api.navigraph.com/mfaFailed"): 245 self._updateProgress(SIMBRIEF_PROGRESS_WAITING_LOGIN, 246 SIMBRIEF_RESULT_ERROR_LOGIN_FAILED, None) 157 247 elif url.startswith("https://www.simbrief.com/ofp/ofp.loader.api.php"): 158 248 self._updateProgress(SIMBRIEF_PROGRESS_WAITING_RESULT, … … 201 291 #------------------------------------------------------------------------------ 202 292 203 def initialize(initializedCallback ):293 def initialize(initializedCallback, gui): 204 294 """Initialize the Chrome Embedded Framework.""" 205 295 global _toQuit, _simBriefHandler … … 208 298 GObject.threads_init() 209 299 210 _simBriefHandler = SimBriefHandler( )300 _simBriefHandler = SimBriefHandler(gui) 211 301 GObject.timeout_add(100, _initializeCEF, [], initializedCallback) 212 302 -
src/mlx/gui/gui.py
r1181 r1186 1999 1999 It checks if we already know the PID, and if not, asks the user whether 2000 2000 to register.""" 2001 cef.initialize(self._cefInitialized )2001 cef.initialize(self._cefInitialized, self) 2002 2002 2003 2003 if not self.config.pilotID and not self.config.password:
Note:
See TracChangeset
for help on using the changeset viewer.