Skip to content

Commit

Permalink
304 - Tackles the webkit-issue by adding another POST-based route for…
Browse files Browse the repository at this point in the history
… logout (#365)

* Add a POST-based route for log out instead of DELETE-based

* Fix test to check against newly added route
  • Loading branch information
marcfreiheit authored and bdaase committed Feb 4, 2019
1 parent a386d23 commit 78e794c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/views/application/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
<%= link_to('Profile', user_path(current_user), class: "dropdown-item") %>
<%= link_to('Logout', destroy_user_session_path, method: :delete, class: "text-danger dropdown-item") %>
<%= link_to('Logout', new_sign_out_path, method: :post, class: "text-danger dropdown-item") %>
</div>
</li>
<% end %>
Expand Down
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
get 'slack/new' => 'slack#new', as: :new_slack
get 'slack/auth' => 'slack#update', as: :update_slack

devise_scope :user do # temporary fix related to GitHub issue 304
post '/users/new_sign_out' => 'devise/sessions#destroy', as: :new_sign_out
end
devise_for :users,
path: 'users',
controllers: {
Expand Down
10 changes: 4 additions & 6 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
t.datetime "updated_at", null: false
t.integer "port"
t.string "application_name"
t.integer "user_id"
t.text "description"
t.integer "user_id"
t.index ["user_id"], name: "index_requests_on_user_id"
end

Expand Down Expand Up @@ -129,11 +129,11 @@
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.integer "role"
t.string "first_name"
t.string "last_name"
t.string "ssh_key"
t.string "provider"
t.string "uid"
t.string "ssh_key"
t.string "first_name"
t.string "last_name"
t.integer "user_id"
t.boolean "email_notifications", default: false
t.index ["email"], name: "index_users_on_email", unique: true
Expand All @@ -146,8 +146,6 @@
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["request_id"], name: "index_users_assigned_to_requests_on_request_id"
t.index ["user_id"], name: "index_users_assigned_to_requests_on_user_id"
end

create_table "users_virtual_machine_configs", id: false, force: :cascade do |t|
Expand Down
2 changes: 1 addition & 1 deletion spec/features/sessions/user_sign_out_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
end

it 'has a logout button' do
expect(page).to have_link 'Logout', href: destroy_user_session_path
expect(page).to have_link 'Logout', href: new_sign_out_path
end

it 'logs out the user' do
Expand Down

0 comments on commit 78e794c

Please sign in to comment.