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
user auth flow #1
Merged
Merged
Conversation
This file contains 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
SophieDeBenedetto
force-pushed
the
user-session
branch
from
July 10, 2019 14:55
cc8f56e
to
5a077ec
Compare
SophieDeBenedetto
force-pushed
the
user-session
branch
from
July 10, 2019 14:55
5a077ec
to
4f2196d
Compare
changeset = User.changeset(%User{}, params["user"]) | ||
if changeset.valid? do | ||
user = Ecto.Changeset.apply_changes(changeset) | ||
put_session(conn, :username, user.username) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could refactor this into a function like, login
or something more descriptive
I added an extremely DIY logo for now, just to have something fun to look at that isn't the "Phoenix Framework" image. |
doomspork
reviewed
Jul 10, 2019
doomspork
requested changes
Jul 10, 2019
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.
This is can probably be refactored a bit but wanted to get the PR up to make sure we're comfortable with this direction:
This PR introduces the following behavior:
As an un-authenticated user
When I visit the root path
I see a welcome page and link to log in
When I click the link to log in, I am taken to
/login
where I can "log in" with just a usernameWhen I fill out the username field and click "log in"
Then I am redirect to the
/cards
page and I see the header includes a greeting,"Hi, #{my_username}"
and a link to log outWhen I do NOT fill out the username field and click "log in"
Then the login page re-renders and I see an error message that the username field cannot be blank
As authenticated user
When I visit the root path
Then I see a welcome page with a link the header to log out
When I click "log out"
I am redirected to the
/login
pathAs an authenticated user
When I visit
/cards
Then I see the first card's title and the header includes a link to log out