From 29ebe44c2368c8510eea47ff15557ab115c86e67 Mon Sep 17 00:00:00 2001 From: Sindhuja-G Date: Mon, 2 Feb 2026 20:30:43 +0530 Subject: [PATCH 1/2] Login Functionality --- .gitignore | 1 + Programs/login.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 Programs/login.py diff --git a/.gitignore b/.gitignore index bee8a64..1efb85e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ __pycache__ +.appmodconfig diff --git a/Programs/login.py b/Programs/login.py new file mode 100644 index 0000000..34ab7d2 --- /dev/null +++ b/Programs/login.py @@ -0,0 +1,32 @@ +class LoginSystem: + def __init__(self): + self.valid_email = "user@test.com" + self.valid_password = "Password@123" + self.failed_attempts = 0 + self.locked = False + + def login(self, email, password): + if self.locked: + return "Account is locked. Contact support." + + if email == self.valid_email and password == self.valid_password: + self.failed_attempts = 0 + return "Login Successful ✅" + + else: + self.failed_attempts += 1 + + if self.failed_attempts >= 3: + self.locked = True + return "Account locked due to 3 failed attempts ❌" + + return f"Invalid credentials. Attempts left: {3 - self.failed_attempts}" + +# ----- Testing the function ----- + +app = LoginSystem() + +print(app.login("wrong@test.com", "123")) # Test case 1 +print(app.login("wrong@test.com", "123")) # Test case 2 +print(app.login("wrong@test.com", "123")) # Test case 3 (locks account) +print(app.login("user@test.com", "Password@123")) # Should fail because account is locked From 5059c5f9c358228d4a44d01ce2b77e954f6a19f3 Mon Sep 17 00:00:00 2001 From: Sindhuja Golagani Date: Mon, 2 Feb 2026 20:35:26 +0530 Subject: [PATCH 2/2] Update Programs/login.py Co-authored-by: appmod-pr-genie[bot] <229331807+appmod-pr-genie[bot]@users.noreply.github.com> --- Programs/login.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Programs/login.py b/Programs/login.py index 34ab7d2..d4f5233 100644 --- a/Programs/login.py +++ b/Programs/login.py @@ -1,7 +1,7 @@ class LoginSystem: def __init__(self): - self.valid_email = "user@test.com" - self.valid_password = "Password@123" + self.valid_email = os.getenv("VALID_EMAIL") + self.valid_password = os.getenv("VALID_PASSWORD") self.failed_attempts = 0 self.locked = False