Add token validation

This commit is contained in:
2025-08-21 00:49:18 +02:00
parent 626e6b6aee
commit c855fda3dc
4 changed files with 34 additions and 12 deletions

View File

@@ -9,11 +9,11 @@ async def setcredentials(update: Update, context: ContextTypes.DEFAULT_TYPE, use
user_id = str(update.effective_user.id)
args = context.args
if len(args) != 2:
return await update.message.reply_text("Usage: `/setcredentials <username> <password>`")
role = users.get_role(user_id)
if role not in (Role.ADMIN, Role.MEMBER):
return await update.message.reply_text("Only members or admins can set credentials")
if len(args) != 2:
return await update.message.reply_text("Usage: `/setcredentials <username> <password>`")
if users.set_credentials(user_id, Credential(args[0], args[1])):
await update.message.reply_text("Credentials saved")
else: