Sha256: 9909ec45a2db2fc4300871db771632ff626bdd62d49f63ab9d70691f5540a2dd

Contents?: true

Size: 688 Bytes

Versions: 74

Compression:

Stored size: 688 Bytes

Contents

import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
  static targets = ['element']

  static values = {
    confirm: String,
  }

  /**
  We are intercepting the sign-out submission to clear the cache first.
  By clearing the Turbo cache we are ensuring that when someone presses the back button
  after a sign-out attempt, the cache is not there in the browser and they can't
  navigate back to see sensitive information from the previous page.
  */
  handle(e) {
    e.preventDefault()

    // eslint-disable-next-line no-alert
    if (window.confirm(this.confirmValue)) {
      window.Turbo.cache.clear()

      this.element.submit()
    }
  }
}

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
avo-3.16.4 app/javascript/js/controllers/sign_out_controller.js
avo-3.16.3 app/javascript/js/controllers/sign_out_controller.js
avo-3.16.2 app/javascript/js/controllers/sign_out_controller.js
avo-3.16.1 app/javascript/js/controllers/sign_out_controller.js
avo-3.16.0 app/javascript/js/controllers/sign_out_controller.js
avo-3.15.7 app/javascript/js/controllers/sign_out_controller.js
avo-3.15.6 app/javascript/js/controllers/sign_out_controller.js
avo-3.15.5 app/javascript/js/controllers/sign_out_controller.js
avo-3.15.4 app/javascript/js/controllers/sign_out_controller.js
avo-3.15.3 app/javascript/js/controllers/sign_out_controller.js
avo-3.15.2 app/javascript/js/controllers/sign_out_controller.js
avo-3.15.1 app/javascript/js/controllers/sign_out_controller.js
avo-3.15.0 app/javascript/js/controllers/sign_out_controller.js
avo-3.14.5 app/javascript/js/controllers/sign_out_controller.js
avo-3.14.4 app/javascript/js/controllers/sign_out_controller.js
avo-3.14.3 app/javascript/js/controllers/sign_out_controller.js
avo-3.14.2 app/javascript/js/controllers/sign_out_controller.js
avo-3.14.1 app/javascript/js/controllers/sign_out_controller.js
avo-3.14.0 app/javascript/js/controllers/sign_out_controller.js
avo-3.13.7 app/javascript/js/controllers/sign_out_controller.js