Single lesson · Written for AQA GCSE Computer Science (8525)

Authentication routines – AQA GCSE Computer Science lesson (8525)

Pupils learn to write a simple authentication routine in the class's language with a username and password and a limit on attempts.

Also in a bundle Cyber Security and Robust Programs – AQA GCSE Computer Science lessons (8525) 14 lessons for £39 · save 30% on buying separately

Lesson 10 of 14 in unit 11.1 Cyber Security and Robust Programs, taught in Year 11, Autumn 1. It answers one big question: How does a program check who a user really is?

By the end, pupils can write a simple authentication routine in the class's language with a username and password and a limit on attempts.

The Build (the main task)
Write a program for the staff log-in of Kickstand's order system that: stores the username packer1 and the password Laces42!; asks the user to enter a username and a password; checks them against the stored values; allows up to three attempts; outputs Logged in if a correct pair is entered, or Account locked after three failed attempts. You should use indentation and meaningful identifiers. (8 marks)
Support version
Part-filled code with the stored values, the attempt counter and the loop line written.
Challenge
Rewrite the check as a function checkLogin that takes a username and a password as parameters and returns True if they match the stored values, otherwise False. Use it in the three-attempt loop. (6 marks) Extend your log-in so that after each failed attempt it outputs Attempts left: followed by the number of tries the user has left. (6 marks)
Real-world link
The staff log-in for Kickstand's order system.
Key words
Authentication, Password and Verify, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“An authentication routine only needs to check the password”; “The loop should keep going forever until the password is right”.
AQA 8525 specification
3.2.11 (robust and secure programming: validation, authentication, testing, test data, errors).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Pupils need computers for the main task.

Also sold in the Cyber Security and Robust Programs unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

Choose your school's Paper 1 language when you buy: C#, Python or VB.NET. You get that language's files: every program, code example, worked answer and programming task is written in it, and lessons with no code are the same in all three. Algorithms are also shown in AQA pseudo-code, as in the exam.

An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Single-teacher licence: use and adapt it with your own classes
  • Your choice of Paper 1 language: C#, Python or VB.NET

More for GCSE Computer Science (AQA)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.