Fixed bug 941236 - Adjusted middleware to prevent unauthorized access to user accounts