Database sessions

Security fixes and sign-in fixes