Writing Secure Authentication Logic - trial