![]() |
Codeigniter and Ionic framework - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Codeigniter and Ionic framework (/showthread.php?tid=69571) |
Codeigniter and Ionic framework - theedo - 12-16-2017 Hello! I'm creating an app based on Ionic framework with a PHP Backend. I'm using the Rest Server library for CI. Now, I've a "logic" problem about the login. I've two input, I send a POST request through AngularJS to my API, here I check all data, I filter the input, check if user exists, if the password is correct and so on. If all is ok, I send to the app a json_encode array with the session that I stored. This is the code: PHP Code: $new_data = array('mail' => $utente->email, 'uid' => $utente->id, 'logged_in' => 'yes'); Then, I set a localStorage with the session stored in that. Why that? Because I want that if the user close the app, without clicking on "logout", whene he opens the app is logged in. Now my question is: is secure to store the session in the localStorage? This is my localStorage after the login: ![]() I can edit the "uid" value, uid obviously is the user_id. So I think it isn't a secure method to store user session. How can I do that? Thank you! |