diff --git a/Gemfile b/Gemfile index bc8ceb5..9701228 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ gem "jbuilder" gem "oauth2", "~> 2.0.x" gem "omniauth", "~> 2.1", ">= 2.1.2" gem "omniauth-orcid" +gem "omniauth-rails_csrf_protection" gem "pg" gem "puma", "5.6.8" gem "rack", "2.2.8.1" diff --git a/Gemfile.lock b/Gemfile.lock index 0fabbbd..d030d52 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -316,6 +316,9 @@ GEM omniauth-orcid (2.1.1) omniauth-oauth2 (~> 1.3) ruby_dig (~> 0.0.2) + omniauth-rails_csrf_protection (1.0.2) + actionpack (>= 4.2) + omniauth (~> 2.0) openapi3_parser (0.9.2) commonmarker (~> 0.17) openapi_parser (1.0.0) @@ -551,6 +554,7 @@ DEPENDENCIES omniauth (~> 2.1, >= 2.1.2) omniauth-cas (~> 3.0) omniauth-orcid + omniauth-rails_csrf_protection pg pry-byebug puma (= 5.6.8) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 74e0f77..3492486 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -15,6 +15,6 @@ def session_path(_scope) end def after_sign_in_path_for(_resource) - "/users/#{@user.id}" + "/users/#{current_user.id}" end end diff --git a/app/javascript/entrypoints/application.scss b/app/javascript/entrypoints/application.scss index 80a7995..f841d3d 100644 --- a/app/javascript/entrypoints/application.scss +++ b/app/javascript/entrypoints/application.scss @@ -150,11 +150,30 @@ a { margin-right: 2rem; } +#login-button-black { + box-shadow: 10px 10px #E57401; + font-family: "Montserrat", sans-serif; + font-weight: bold; + font-size: 1.3rem; + color: #fff; + background-color: #000; + border: none; + padding: 0.7rem 2.4rem; + height: 3.5rem; + margin: 3rem 2rem; +} + #text-box, #login-button { display: inline-block; } +#sign-in-page { + max-width: 1440px; + min-width: 710px; + margin: 1rem auto 0 auto; +} + .line { background-color: #E77500; width: 100%; diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb new file mode 100644 index 0000000..e790980 --- /dev/null +++ b/app/views/devise/sessions/new.html.erb @@ -0,0 +1,5 @@ +
+

Log in to ORCID@Princeton

+ <%= button_to "Log-in", user_cas_omniauth_authorize_path, :id => "login-button-black", :type => 'submit', :onclick => "log_plausible_cas_user_login()", :method => :post %> +
+
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 72f67a5..76504bc 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -17,7 +17,7 @@

Connect your ORCID id to Princeton so that published works can be easily identified as belonging to all Princeton researchers.

- <%= button_to "Log-in", user_cas_omniauth_authorize_path, :id => "login-button", :onclick => "log_plausible_cas_user_login()", :method => :get %> + <%= button_to "Log-in", user_cas_omniauth_authorize_path, :id => "login-button", :type => 'submit', :onclick => "log_plausible_cas_user_login()", :method => :post %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 0553c29..1b833f8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -25,7 +25,6 @@ devise_scope :user do get "sign_in", to: "devise/sessions#new", as: :new_user_session - get "sign_in", to: "users/omniauth_callbacks#passthru", as: :session get "sign_out", to: "devise/sessions#destroy", as: :destroy_user_session post ":id/validate-tokens", to: "users#validate_tokens", as: :validate_tokens end