Skip to content

Commit

Permalink
Add Remember me checkbox to login page
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Decuir committed Apr 6, 2018
1 parent 9ab2c26 commit 54fb207
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/app/controllers/user_sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ def destroy
redirect_to root_path
end

private
private

def participant_session_params
params.require(:participant_session).permit(:email, :password)
params.require(:participant_session).permit(:email, :password, :remember_me)
end

end
4 changes: 4 additions & 0 deletions src/app/views/user_sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
<%= f.input :email, :label => 'Email' %>
<%= f.input :password, :label => 'Password', :as => :password %>
<%= f.label :remember_me do %>
<%= f.check_box :remember_me %>
Remember me
<% end %>
<% end %>
<%= f.actions do %>
Expand Down
5 changes: 2 additions & 3 deletions src/spec/features/sign_in_and_out_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

fill_in 'Email', with: user.email
fill_in 'Password', with: user.password
check 'Remember me'
click_button "Log in"

expect(page).to have_content "You're logged in. Welcome back."
Expand All @@ -32,7 +33,7 @@
expect(page).to have_content "You have been logged out."
end

scenario "As a user can register a new account" do
scenario "As a user I can register a new account" do
visit root_path

click_link "Log in"
Expand All @@ -48,7 +49,6 @@
expect(page).to have_content "Welcome #{name}"
end


scenario "As a user I try to register a new account with an already taken email address" do
visit root_path

Expand All @@ -67,4 +67,3 @@
end
end
end

0 comments on commit 54fb207

Please sign in to comment.