Open Nannymeta opened 2 years ago
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @eikef @kris2kris @ndclt click here for bot help
Files identified in the description:
If these files are incorrect, please update the component name
section of the description or use the !component
bot command.
cc @mattock click here for bot help
import pyotp import telegram from telegram.ext import Updater, MessageHandler, Filters
TOKEN = 'votre_token'
updater = Updater(token=TOKEN, use_context=True) dispatcher = updater.dispatcher
def generate_google_secret_key(): return pyotp.random_base32()
def generate_google_code(secret_key): totp = pyotp.TOTP(secret_key) return totp.now()
def generate_instagram_secret_key(): return pyotp.random_base32(length=32)
def generate_instagram_code(secret_key): totp = pyotp.TOTP(secret_key, digits=8) return totp.now()
def send_otp(chat_id, code, service): updater.bot.send_message(chat_id=chat_id, text=f"Votre code OTP {service} est: {code}")
def handle_message(update, context): chat_id = update.effective_chat.id
# Générer le secret key et le code Google Authenticator
google_secret_key = generate_google_secret_key()
google_code = generate_google_code(google_secret_key)
# Générer le secret key et le code Instagram
instagram_secret_key = generate_instagram_secret_key()
instagram_code = generate_instagram_code(instagram_secret_key)
# Envoyer les codes OTP sur Telegram
send_otp(chat_id, google_code, 'Google')
send_otp(chat_id, instagram_code, 'Instagram')
dispatcher.add_handler(MessageHandler(Filters.text, handle_message))
updater.start_polling() updater.idle()
cc @thomasbach-dev click here for bot help
Summary
Add configure OTP parameter as a required action on keycloak_realm.py.
This would be great because today it's a manual action. It's already working for verify email option.
Issue Type
Feature Idea
Component Name
keycloak_realm
Additional Information
Code of Conduct