Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.console.config.load()
if self.console.config.get(config.key_otp_key) is None:
self.system_alert(f'{self.console.ptt_id} 歡迎使用 Ptt OTP')
rule_form = rule_window.Form(self.console)
rule_form.show()
rule_form.exec_()
if not rule_form.ok:
self.system_alert('Ptt OTP 感謝您的試用')
time.sleep(3)
self.exit_func()
otp_key = pyotp.random_base32()
otp_url = pyotp.totp.TOTP(otp_key).provisioning_uri(self.console.ptt_id, issuer_name="Ptt OTP")
img = qrcode.make(otp_url)
img.save('./temp.png')
show_verify_form = show_verify.Form(self.console, otp_key)
show_verify_form.show()
show_verify_form.exec_()
os.remove('./temp.png')
if not show_verify_form.ok:
self.system_alert('Ptt OTP 感謝您的試用')
time.sleep(3)
self.exit_func()
self.console.config.set(config.key_otp_key, otp_key)