Skip to content

Default Login Auth System

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

Implementation:

  • Include auth.php to
  • Include loadUser() in the theme after the page permissions are set

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

On page load, include auth.php before anything else

  • Check if user is logged in
    • If logged in, set cookies / sessions
    • If not logged in, set permissions to none
  • Check if on registration page
    • if logged in, throw error
    • if not logged in, set flag to not display user box
  • Check permissions on page
    • If permissions allow, load page
    • If permissions don't, check if logged in
      • No? Show login screen
      • Yes? Show error msg with link to home page