disable turbo. unwanted side effects.
This commit is contained in:
parent
882f7c4567
commit
522cd56807
5 changed files with 26 additions and 17 deletions
6
Gemfile
6
Gemfile
|
|
@ -11,9 +11,9 @@ gem 'puma', '>= 5.0'
|
||||||
# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
|
# Bundle and transpile JavaScript [https://github.com/rails/jsbundling-rails]
|
||||||
# gem 'jsbundling-rails'
|
# gem 'jsbundling-rails'
|
||||||
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
||||||
gem 'turbo-rails'
|
# gem 'turbo-rails'
|
||||||
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
||||||
gem 'stimulus-rails'
|
# gem 'stimulus-rails'
|
||||||
# Bundle and process CSS [https://github.com/rails/cssbundling-rails]
|
# Bundle and process CSS [https://github.com/rails/cssbundling-rails]
|
||||||
# gem 'cssbundling-rails'
|
# gem 'cssbundling-rails'
|
||||||
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
|
||||||
|
|
@ -167,4 +167,4 @@ gem 'cssbundling-rails', '~> 1.4'
|
||||||
|
|
||||||
gem 'importmap-rails', '~> 2.1'
|
gem 'importmap-rails', '~> 2.1'
|
||||||
|
|
||||||
gem "rails_icons", "~> 1.3"
|
gem 'rails_icons', '~> 1.3'
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||||
import "@hotwired/turbo-rails"
|
// import "@hotwired/turbo-rails"
|
||||||
// import "controllers"
|
// import "controllers"
|
||||||
|
|
||||||
// import Lightbox from "photoswipe";
|
// import Lightbox from "photoswipe";
|
||||||
|
|
@ -154,8 +154,8 @@ function display_error(msg) { console.log("foo");
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
|
||||||
// document.addEventListener("DOMContentLoaded", () => {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
document.addEventListener("turbo:load", () => {
|
// document.addEventListener("turbo:load", () => {
|
||||||
console.log("DOM loaded");
|
console.log("DOM loaded");
|
||||||
// Handle uploads on specific views/pages. The DIV with ID
|
// Handle uploads on specific views/pages. The DIV with ID
|
||||||
// #data-js-upload-form carries data attributes that tell us where
|
// #data-js-upload-form carries data attributes that tell us where
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,14 @@
|
||||||
|
|
||||||
hr
|
hr
|
||||||
|
|
||||||
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f|
|
= form_for(resource, as: resource_name, url: session_path(resource_name), data: { turbo: false }) do |f|
|
||||||
= f.hidden_field :provider, value: 'local'
|
= f.hidden_field :provider, value: 'local'
|
||||||
|
|
||||||
.grid-x.grid-padding-x.align-center
|
.grid-x.grid-padding-x.align-center
|
||||||
.cell.small-4
|
.cell.small-4
|
||||||
h4.text-center Debian staff login
|
h4.text-center Debian staff login
|
||||||
p.text-center
|
p.text-center
|
||||||
= link_to (icon('key-round'), text: 'Login via Salsa'), user_salsa_omniauth_authorize_path, class: 'button primary large', method: :post
|
= link_to icon('key-round') + 'Login via Salsa', user_salsa_omniauth_authorize_path, class: 'button primary large', method: :post
|
||||||
.cell.small-4
|
.cell.small-4
|
||||||
h4.text-center Admin login
|
h4.text-center Admin login
|
||||||
p.text-center
|
p.text-center
|
||||||
|
|
@ -53,6 +53,7 @@ hr
|
||||||
= f.submit "Sign in", class: 'button'
|
= f.submit "Sign in", class: 'button'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/ - if devise_mapping.rememberable?
|
/ - if devise_mapping.rememberable?
|
||||||
/ .small-6.cell
|
/ .small-6.cell
|
||||||
/ = f.check_box :remember_me
|
/ = f.check_box :remember_me
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,6 @@
|
||||||
/ BUG: DELETE method is not used
|
/ BUG: DELETE method is not used
|
||||||
- if current_user
|
- if current_user
|
||||||
li
|
li
|
||||||
= link_to destroy_user_session_path, data: { turbo_method: :delete }
|
= link_to destroy_user_session_path
|
||||||
= icon 'lock'
|
= icon 'lock'
|
||||||
'Logout
|
'Logout
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,14 @@
|
||||||
# Use this hook to configure devise mailer, warden hooks and so forth.
|
# Use this hook to configure devise mailer, warden hooks and so forth.
|
||||||
# Many of these configuration options can be set straight in your model.
|
# Many of these configuration options can be set straight in your model.
|
||||||
Devise.setup do |config|
|
Devise.setup do |config|
|
||||||
|
# When using Devise with Hotwire/Turbo, the http status for error responses
|
||||||
|
# and some redirects must match the following. The default in Devise for existing
|
||||||
|
# apps is `200 OK` and `302 Found` respectively, but new apps are generated with
|
||||||
|
# these new defaults that match Hotwire/Turbo behavior.
|
||||||
|
# Note: These might become the new default in future versions of Devise.
|
||||||
|
config.responder.error_status = :unprocessable_entity
|
||||||
|
config.responder.redirect_status = :see_other
|
||||||
|
|
||||||
# The secret key used by Devise. Devise uses this key to generate
|
# The secret key used by Devise. Devise uses this key to generate
|
||||||
# random tokens. Changing this key will render invalid all existing
|
# random tokens. Changing this key will render invalid all existing
|
||||||
# confirmation, reset password and unlock tokens in the database.
|
# confirmation, reset password and unlock tokens in the database.
|
||||||
|
|
@ -41,7 +49,7 @@ Devise.setup do |config|
|
||||||
# You can also supply a hash where the value is a boolean determining whether
|
# You can also supply a hash where the value is a boolean determining whether
|
||||||
# or not authentication should be aborted when the value is not present.
|
# or not authentication should be aborted when the value is not present.
|
||||||
# config.authentication_keys = [:email]
|
# config.authentication_keys = [:email]
|
||||||
config.authentication_keys = [:email, :provider]
|
config.authentication_keys = %i[email provider]
|
||||||
|
|
||||||
# Configure parameters from the request object used for authentication. Each entry
|
# Configure parameters from the request object used for authentication. Each entry
|
||||||
# given should be a request method and it will automatically be passed to the
|
# given should be a request method and it will automatically be passed to the
|
||||||
|
|
@ -256,7 +264,7 @@ Devise.setup do |config|
|
||||||
# config.navigational_formats = ['*/*', :html]
|
# config.navigational_formats = ['*/*', :html]
|
||||||
|
|
||||||
# The default HTTP method used to sign out a resource. Default is :delete.
|
# The default HTTP method used to sign out a resource. Default is :delete.
|
||||||
config.sign_out_via = :delete
|
config.sign_out_via = :get
|
||||||
|
|
||||||
# ==> OmniAuth
|
# ==> OmniAuth
|
||||||
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
||||||
|
|
@ -292,18 +300,18 @@ Devise.setup do |config|
|
||||||
# Configuration: https://github.com/m0n9oose/omniauth_openid_connect
|
# Configuration: https://github.com/m0n9oose/omniauth_openid_connect
|
||||||
config.omniauth :openid_connect, {
|
config.omniauth :openid_connect, {
|
||||||
name: :salsa,
|
name: :salsa,
|
||||||
scope: [:openid, :email, :profile],
|
scope: %i[openid email profile],
|
||||||
discovery: true,
|
discovery: true,
|
||||||
issuer: "https://salsa.debian.org",
|
issuer: 'https://salsa.debian.org',
|
||||||
client_options: {
|
client_options: {
|
||||||
port: 443,
|
port: 443,
|
||||||
scheme: "https",
|
scheme: 'https',
|
||||||
host: "salsa.debian.org",
|
host: 'salsa.debian.org',
|
||||||
identifier: ENV['SALSA_OAUTH_KEY'],
|
identifier: ENV['SALSA_OAUTH_KEY'],
|
||||||
secret: ENV['SALSA_OAUTH_SECRET'],
|
secret: ENV['SALSA_OAUTH_SECRET'],
|
||||||
#redirect_uri: "http://localhost:3000/users/auth/salsa/callback",
|
# redirect_uri: "http://localhost:3000/users/auth/salsa/callback",
|
||||||
redirect_uri: "#{Rails.configuration.base_url}/users/auth/salsa/callback",
|
redirect_uri: "#{Rails.configuration.base_url}/users/auth/salsa/callback",
|
||||||
ssl: { ca_path: '/etc/ssl/certs'}
|
ssl: { ca_path: '/etc/ssl/certs' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OpenIDConnect.logger = Rails.logger
|
OpenIDConnect.logger = Rails.logger
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue