The best way to do this is just check the option in the security assist wizard. I've attached a screen grab of the page where the option appears.
The two checkboxes are for "remember me" and "auto login"... remember me just remembers the username and you still have to type in the password. "Auto Login" will actually bypass the login screen and the person stays logged in.
You can click the lightning bolt to use custom triggers. Just choose the associated checkbox field.
I'd strongly suggest using the wizard to do this for you on another page, and then you can reverse engineer it from there. You could even copy and paste things like the checkboxes and store session server behavior code.