Signed up recently but had issues with the confirmation email?

Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.

Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.

Revision notesQuestionsFor schools
Revise Computing
Log inStart revising free
Revision notesQuestionsFor schoolsLog in
GCSE Computer Science/Supplementary programming practice/Defensive Design

Authentication

301.16 Defensive Design

Practise exam questions

Defensive Design — Note 3 of 5

Username + password.

What you need to know

Authentication verifies a user's identity, typically with a username and password. A simple implementation checks entered credentials against stored values.

What to know

  • Compare entered username and password against stored values
  • Give limited attempts to prevent brute force
  • Don't reveal which field was wrong (security)
  • Use == for comparison, not =

Code examples

Simple login
python
STORED_USER = "admin"
STORED_PASS = "secret123"
attempts = 3

user = input("Username: ")
pwd = input("Password: ")
while (user != STORED_USER or pwd != STORED_PASS) and attempts > 1:
    attempts -= 1
    print("Incorrect. " + str(attempts) + " attempts left")
    user = input("Username: ")
    pwd = input("Password: ")

if user == STORED_USER and pwd == STORED_PASS:
    print("Login successful")
else:
    print("Account locked")
← Previous noteValidation checks301.16 Defensive DesignNext note →Validation subprograms301.16 Defensive Design

Back to Defensive Design

Specification notes for programming are in Paper 2.

Defensive Design

Note 3 of 5

  1. 1Anticipate misuse
  2. 2Validation checks
  3. 3Authentication
  4. 4Validation subprograms
  5. 5Error messaging
Topic overview

© 2026 Revise Computing · revisecomputing.co.uk

Worried about something?Question Bank UpdatesPrivacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).