reverted back to working middleware
 changed login/register pages to keep navigation