pub fn create_user_session(
db: &mut Connection,
device_type: Option<String>,
ttl: Option<i64>,
user_id: i32,
) -> Result<(String, String), (u16, &'static str)>
Expand description
create a user session for the user with user_id
§Errors
- 400: ‘device’ cannot be longer than 256 characters.
- 500: An internal server error occurred.
- 500: Could not create session.
§Panics
- could not connect to database
- could not get
SECRET_KEY
from environment
TODO: don’t panic if db connection fails, just return an error