Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require session middleware #15

Merged
merged 2 commits into from
Aug 24, 2017
Merged

Require session middleware #15

merged 2 commits into from
Aug 24, 2017

Conversation

michaeldfallen
Copy link
Contributor

This PR implements the requireSession middleware. It is based off of #13 Simple Sessions.

It can be added to a step to enforce a session on that page. By default it redirects to / (TODO: should be configurable with some startpage property from Journey or infer from which step is of type Start?). You can override the behaviour by providing a noSessionHandler to the journey function.

CreateSession and DestroySession can be created using similar approaches.

@michaeldfallen michaeldfallen force-pushed the require-session branch 2 times, most recently from 12f2957 to 49034ef Compare August 23, 2017 15:16
@codecov-io
Copy link

codecov-io commented Aug 23, 2017

Codecov Report

Merging #15 into master will increase coverage by 0.08%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #15      +/-   ##
==========================================
+ Coverage   99.23%   99.31%   +0.08%     
==========================================
  Files           7        8       +1     
  Lines         131      147      +16     
==========================================
+ Hits          130      146      +16     
  Misses          1        1
Impacted Files Coverage Δ
src/services/sessions.js 97.5% <100%> (-0.07%) ⬇️
src/Journey.js 100% <100%> (ø) ⬆️
src/middleware/requireSession.js 100% <100%> (ø)
src/services/sessions/shims.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b72680b...3151730. Read the comment docs.

@michaeldfallen michaeldfallen changed the base branch from simple-sessions to master August 24, 2017 13:34
@michaeldfallen michaeldfallen merged commit 8ab9c48 into master Aug 24, 2017
@michaeldfallen michaeldfallen deleted the require-session branch August 24, 2017 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants