Skip to content

Commit

Permalink
Fixed errors key missing from session
Browse files Browse the repository at this point in the history
Added the errors key back into the session flash.
Changed the View errors helper name from ‘bag’  back to ‘errors’
  • Loading branch information
circulon committed Aug 22, 2024
1 parent 80c738b commit 4892c1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/masonite/middleware/route/SessionMiddleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ def before(self, request, response):
request.app.make("request").session = Session

# TODO: Remove in Masonite 5
request.app.make("view").share({"bag": MessageBag(Session.get("errors") or {}).helper})
bag = MessageBag(Session.get("errors") or {})
request.app.make("view").share({"errors": bag.helper})
# errors are stored in session flash so 'getting' them actually clears them
# so re-add them to the session as a MessageBag
Session.flash('errors', bag)
return request

def after(self, request, _):
Expand Down

0 comments on commit 4892c1c

Please sign in to comment.