mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 10:03:40 +01:00
Add web-verification
This commit is contained in:
parent
b662831193
commit
f2780d1f44
4 changed files with 10 additions and 8 deletions
|
@ -31,7 +31,8 @@ async def send_verification_code(user: discord.User, student_number: str, **kwar
|
|||
f"Go back to the #verify channel, and click 'I have a verification code!', and put {code} in the modal"
|
||||
f" that pops up\n\n"
|
||||
f"If you have any issues getting in, feel free to reply to this email, or DM eek#7574.\n"
|
||||
f"~Nex"
|
||||
f"~Nex\n\n\n"
|
||||
f"(P.S you can now go to http://droplet.nexy7574.co.uk/jimmy/verify/{code} instead)"
|
||||
)
|
||||
msg = EmailMessage()
|
||||
msg["From"] = msg["bcc"] = "B593764@my.leedscitycollege.ac.uk"
|
||||
|
|
|
@ -24,7 +24,7 @@ class Bot(commands.Bot):
|
|||
from .db import JimmyBans, registry
|
||||
from .console import console
|
||||
super().__init__(
|
||||
command_prefix=self.get_prefix,
|
||||
command_prefix=commands.when_mentioned_or("h!", "r!"),
|
||||
debug_guilds=guilds,
|
||||
allowed_mentions=discord.AllowedMentions.none(),
|
||||
intents=intents,
|
||||
|
|
|
@ -130,7 +130,7 @@ class VerifyView(View):
|
|||
return await interaction.followup.send(f"\N{cross mark} Failed to send email - {e}. Try again?")
|
||||
console.log(f"Sending verification email to {interaction.user} ({interaction.user.id}/{st})...")
|
||||
name = self.children[1].value
|
||||
__code = await VerifyCode.objects.create(code=_code, bind=interaction.id, student_id=st, name=name)
|
||||
__code = await VerifyCode.objects.create(code=_code, bind=interaction.user.id, student_id=st, name=name)
|
||||
console.log(
|
||||
f"[green]Sent verification email to {interaction.user} ({interaction.user.id}/{st}): " f"{_code!r}"
|
||||
)
|
||||
|
|
|
@ -164,7 +164,7 @@ async def verify(code: str):
|
|||
status_code=404,
|
||||
detail="Code not found."
|
||||
)
|
||||
|
||||
|
||||
# Now we need to fetch the student from the database
|
||||
student = await get_or_none(Student, user_id=verify_code.bind)
|
||||
if student:
|
||||
|
@ -195,8 +195,9 @@ async def verify(code: str):
|
|||
# And delete the code
|
||||
await verify_code.delete()
|
||||
|
||||
console.log(f"[green]{verify_code.bind} verified ({verify_code.bing}/{verify_code.student_id})")
|
||||
console.log(f"[green]{verify_code.bind} verified ({verify_code.bind}/{verify_code.student_id})")
|
||||
|
||||
return {
|
||||
"message": "Successfully verified."
|
||||
}
|
||||
return RedirectResponse(
|
||||
"https://ptb.discord.com/channels/994710566612500550/1018915342317277215/",
|
||||
status_code=308
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue