This commit is contained in:
adithyagenie 2022-11-03 01:34:30 +05:30
parent 8fd89a3d5d
commit c749cf56c8
4 changed files with 38 additions and 18 deletions

View file

@ -592,19 +592,23 @@ def forgotpassword(screen):
if input_u not in usernamelist: if input_u not in usernamelist:
screen.addstr( screen.addstr(
y // 2 - 1, 0, "Username does not exist. Press Enter/Space to continue..." y // 2 - 1,
0,
"Username does not exist. Press Enter/Space to continue...",
) )
while True: while True:
key = screen.getch() key = screen.getch()
if key == ord(" ") or key == 10: if key == ord(" ") or key == 10:
screenwipe(screen, sy = y // 2 - 2, sx = x // 2 + 3) screenwipe(screen, sy=y // 2 - 2, sx=x // 2 + 3)
screen.refresh() screen.refresh()
break break
else: else:
break break
res = get(f"SELECT email FROM player_details\ res = get(
WHERE username = '{input_u}'") f"SELECT email FROM player_details\
WHERE username = '{input_u}'"
)
email = res[0][0] email = res[0][0]
otp = sender(input_u, email) otp = sender(input_u, email)
screen.addstr(y // 2 + 1, 0, "Enter OTP recieved in registered mail address:") screen.addstr(y // 2 + 1, 0, "Enter OTP recieved in registered mail address:")
@ -624,20 +628,32 @@ def forgotpassword(screen):
screen.refresh() screen.refresh()
screen.addstr(1, x // 2 - 7, "FORGOT PASSWORD") screen.addstr(1, x // 2 - 7, "FORGOT PASSWORD")
while True: while True:
enter_pass = password(screen, y // 2 - 2, x // 2 - 7, optionaltxt="Enter new password: ") enter_pass = password(
confirm_pass = password(screen, y // 2 + 1, x // 2 - 7, optionaltxt="Confirm password: ") screen, y // 2 - 2, x // 2 - 7, optionaltxt="Enter new password: "
)
confirm_pass = password(
screen, y // 2 + 1, x // 2 - 7, optionaltxt="Confirm password: "
)
if enter_pass == confirm_pass: if enter_pass == confirm_pass:
break break
else: else:
screen.addstr(y // 2 + 3, 0, "Passwords do not match. Press Enter to try again.") screen.addstr(
y // 2 + 3,
0,
"Passwords do not match. Press Enter to try again.",
)
while True: while True:
key = screen.getch() key = screen.getch()
if key == 10: if key == 10:
screenwipe(screen, sy= y // 2 - 2, sx = x // 2 - 7) screenwipe(screen, sy=y // 2 - 2, sx=x // 2 - 7)
break break
else: else:
if tries < 10: if tries < 10:
screen.addstr(y // 2 + 3, 0, "Entered OTP is wrong. Press esc to exit or Enter to try again.") screen.addstr(
y // 2 + 3,
0,
"Entered OTP is wrong. Press esc to exit or Enter to try again.",
)
while True: while True:
key = screen.getch() key = screen.getch()
if key == 10: if key == 10:
@ -653,7 +669,11 @@ def forgotpassword(screen):
continue continue
else: else:
screen.addstr(y // 2 + 3, 0, "Entered OTP is wrong. Maximum tries exceeded. Returning to account menu...") screen.addstr(
y // 2 + 3,
0,
"Entered OTP is wrong. Maximum tries exceeded. Returning to account menu...",
)
sleep(5) sleep(5)
screen.clear() screen.clear()
screen.refresh() screen.refresh()
@ -661,9 +681,11 @@ def forgotpassword(screen):
return return
break break
post(f"UPDATE player_details\ post(
f"UPDATE player_details\
SET password = '{enter_pass}'\ SET password = '{enter_pass}'\
WHERE username = '{input_u}'") WHERE username = '{input_u}'"
)
screen.addstr(y // 2 + 3, x // 2 - 10, "Password has been changed successfully.") screen.addstr(y // 2 + 3, x // 2 - 10, "Password has been changed successfully.")
screen.addstr(y // 2 + 4, x // 2 - 8, "Returning to account menu...") screen.addstr(y // 2 + 4, x // 2 - 8, "Returning to account menu...")
sleep(3) sleep(3)
@ -671,7 +693,6 @@ def forgotpassword(screen):
return return
def leaderboard(screen): def leaderboard(screen):
y, x = screen.getmaxyx() y, x = screen.getmaxyx()
screen.clear() screen.clear()

View file

@ -1,5 +1,6 @@
from maze.modules.maze import main from maze.modules.maze import main
import curses import curses
def bruh(): def bruh():
curses.wrapper(main) curses.wrapper(main)

View file

@ -1 +1 @@
#bruh # bruh

View file

@ -35,9 +35,7 @@ The Labyrinth Team"""
message = MIMEMultipart() message = MIMEMultipart()
message["From"] = sender_address message["From"] = sender_address
message["To"] = receiver_address message["To"] = receiver_address
message[ message["Subject"] = "Reset your Labyrinth account password"
"Subject"
] = "Reset your Labyrinth account password"
message.attach(MIMEText(mail_content, "html")) message.attach(MIMEText(mail_content, "html"))
# Create SMTP session for sending the mail # Create SMTP session for sending the mail