Move session management into some sort of reusable format #18
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: nu/CharmBoard#18
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
As it stands now, the only actual session management in CharmBoard happens in
CharmBoard::Controller::Login
actionlogin_do
,CharmBoard::Controller::Logout
actionlogout_do
, andtemplates/layouts/default/_header.html.ep
(a hacky way to switch between showing a "login" and "logout" button depending on login status, just for dev purposes)As development continues, there will doubtlessly be more places where session verification is needed. Session verification code should be pushed into its own model ASAP to make sure there are no issues of redundant code across multiple parts of CharmBoard, nor issues of session verification methods differing in each instance it shows up which could potentially cause security issues if i.e. one part of the code has weirdly outdated session management code.
Looks like things in the
Model
namespace aren't allowed access to HTTP request data directly, so this may have to actually be split into two modules,CharmBoard::Controller::Session
for the part that fetches the user's session info, andCharmBoard::Model::Session
for the part that fetches the stores session info in the database. I guess. But this feels messy? Either way though the approach I was thinking of before doesn't work....Or the other option would be putting it in
CharmBoard::Util::Session
. I think I need to learn more about how MVC architecture works, I guess.No yeah, a
CharmBoard::Controller::Session
doesn't make sense actually when I think about it harder, knowing what I know about what the Controller namespace is even used for. So Util namespace will probably have to be itI guess destroying a session if its invalid is pretty straightforward, and session creation should only happen once. So maybe a Model that just does the database part of things should suffice?
Move session management into its own module, `CharmBoard::Model::Session`to Move session management into some sort of reusable format