Skip to content

Default Login Auth System

Pamela Gay edited this page Jan 17, 2020 · 5 revisions

Implementation:

  • Include auth.php: Checks if user is logged in

    • If logged in, set cookies / sessions
    • If not logged in, set permissions to none
  • Backend

    • checkPermissions($allowed)
      • $allowed: single string or array of strings of allowed user types.
  • Front end

    • loadUser()
      • If on registration page
        • set flag to not display user box
      • Otherwise
        • if logged in, display user box / logout
        • else show login / register options

How do users log in:

  • Manually, on clicking "Login" in loadUser function, login becomes visible
  • Automatically, on pages where user logged in with bad permissions, log in loads as visible