ワンタイムパスワードの長さを決定(8文字)

This commit is contained in:
suti7yk5032 2024-08-25 23:35:02 +09:00
parent bf1dc817ab
commit de8412e4eb

View file

@ -666,7 +666,6 @@ class Bot(discord.Client):
pass pass
elif isinstance(message.channel, discord.DMChannel): elif isinstance(message.channel, discord.DMChannel):
if message.author.id == dislocker.server_config["bot"]["admin_user_id"]: if message.author.id == dislocker.server_config["bot"]["admin_user_id"]:
msg_split = message.content.split() msg_split = message.content.split()
if msg_split[0] == "/pcreg": if msg_split[0] == "/pcreg":
@ -677,14 +676,17 @@ class Bot(discord.Client):
await message.channel.send(f"# :dizzy_face: 既にワンタイムパスワードは発行されています。\n# パスワード | {onetime}") await message.channel.send(f"# :dizzy_face: 既にワンタイムパスワードは発行されています。\n# パスワード | {onetime}")
else: else:
onetime = str(self.password_generate()) onetime = str(self.password_generate(8))
onetime_config = { onetime_config = {
"onetime": str(onetime) "onetime": str(onetime)
} }
with open(dislocker.onetime_config_path, "w") as w: with open(dislocker.onetime_config_path, "w") as w:
json.dump(onetime_config, w, indent=4) json.dump(onetime_config, w, indent=4)
await message.channel.send(f"# :dizzy_face: PC登録時のワンタイムパスワードを発行します。\n# パスワード | {onetime}") await message.channel.send(f"# :dizzy_face: PC登録時のワンタイムパスワードを発行します。\n# パスワード | {onetime}")
else:
await message.channel.send("# :warning: DMでの応答は、現在無効化されています。")
else:
await message.channel.send("# :warning: DMでの応答は、現在無効化されています。")
""" """
if msg_split[0] == "/password" or msg_split[0] == "/start": if msg_split[0] == "/password" or msg_split[0] == "/start":
@ -727,7 +729,7 @@ class Bot(discord.Client):
await message.channel.send(f":white_check_mark: PC番号 {stop["pc_number"]} の使用が終了されました。") await message.channel.send(f":white_check_mark: PC番号 {stop["pc_number"]} の使用が終了されました。")
await self.get_channel(dislocker.server_config["bot"]["log_channel_id"]).send(f':negative_squared_cross_mark: {stop["name"]} さんがPC {stop["pc_number"]} の使用を終了しました。') await self.get_channel(dislocker.server_config["bot"]["log_channel_id"]).send(f':negative_squared_cross_mark: {stop["name"]} さんがPC {stop["pc_number"]} の使用を終了しました。')
""" """
await message.channel.send("# :warning: DMでの応答は、現在無効化されています。")
elif message.channel.id == dislocker.server_config["bot"]["config_channel_id"]: elif message.channel.id == dislocker.server_config["bot"]["config_channel_id"]:
msg_split = message.content.split() msg_split = message.content.split()