Change token login to get
This commit is contained in:
parent
88096fc46a
commit
328f806d39
2 changed files with 8 additions and 4 deletions
|
@ -5,8 +5,12 @@ class WelcomeController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def token_sign_in
|
def token_sign_in
|
||||||
return head(:unauthorized) unless params[:token] == Rails.application.secrets.koelkast_token
|
if user_signed_in? || params[:token] == Rails.application.secrets.koelkast_token
|
||||||
|
redirect_to root_path
|
||||||
|
return
|
||||||
|
else
|
||||||
koelkast = User.find_by(name: "koelkast")
|
koelkast = User.find_by(name: "koelkast")
|
||||||
sign_in_and_redirect koelkast
|
sign_in_and_redirect koelkast
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
devise_scope :user do
|
devise_scope :user do
|
||||||
get 'sign_out', to: 'devise/sessions#destroy', as: :destroy_user_session
|
get 'sign_out', to: 'devise/sessions#destroy', as: :destroy_user_session
|
||||||
post 'sign_in', to: 'welcome#token_sign_in'
|
get 'sign_in', to: 'welcome#token_sign_in'
|
||||||
unauthenticated :user do
|
unauthenticated :user do
|
||||||
root to: 'welcome#index'
|
root to: 'welcome#index'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue