Added redirect when not logged in

User will be redirected when not logged in and trying to access a
private codeexample