Add web-verification

This commit is contained in:
Nexus 2023-02-23 11:08:57 +00:00
parent b662831193
commit f2780d1f44
Signed by: nex
GPG key ID: 0FA334385D0B689F
4 changed files with 10 additions and 8 deletions

View file

@ -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"

View file

@ -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,

View file

@ -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}"
)

View file

@ -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
)