Consolidate the login code to the session store#120
Open
pstaabp wants to merge 2 commits intoopenwebwork:mainfrom
Open
Consolidate the login code to the session store#120pstaabp wants to merge 2 commits intoopenwebwork:mainfrom
pstaabp wants to merge 2 commits intoopenwebwork:mainfrom
Conversation
WIP: create inflator and subsequent code cleanup.
ba84276 to
56a4c79
Compare
drdrew42
reviewed
Aug 29, 2022
Member
drdrew42
left a comment
There was a problem hiding this comment.
Create and export a constant for the default user -- to be used in testing, login failure, and logout.
| get param_fields(): string[] { return []; } | ||
|
|
||
| constructor(params: ParseableUser = {}) { | ||
| constructor(params: ParseableUser = { user_id: 0, username: '', is_admin: false }) { |
Member
There was a problem hiding this comment.
username: logged_out?
Perhaps export this default as a constant for use in session.ts?
src/stores/session.ts
Outdated
| user_courses: ParseableUserCourse[]; | ||
| } | ||
|
|
||
| const logged_out_user = { username: 'logged_out', user_id: 0, is_admin: false }; |
Member
There was a problem hiding this comment.
import default user from model/users.ts
tests/stores/session.spec.ts
Outdated
| }; | ||
|
|
||
| const logged_out: ParseableUser = { | ||
| const logged_out: SessionUser = { |
WIP: added a default_session_user
534c39e to
9140472
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When logging in if the user is authenticated, there are still a number of things that occur
Although this only needs to be done once, the store tests should be logging in as a non-admin for better testing and these steps need to be done for each test. Therefore, all of these steps are pulled into a single login action in the session store.