import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static values = {
url: String,
delay: { type: Number, default: 800 },
class TurboFailureApp < Devise::FailureApp
def respond
if turbo_request?
redirect_for_turbo
else
super
import express from 'express';
import cookieParser from 'cookie-parser';
import { issueCsrfToken, csrfProtection } from './csrf';
import { transfersRouter } from './routes/transfers';
const app = express();
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :authenticate_user!
end
class ApplicationController < ActionController::Base
before_action :authenticate_user!
rescue_from ActionController::InvalidAuthenticityToken do
handle_unauthenticated(reason: :csrf)
end
import * as Turbo from "@hotwired/turbo";
function metaContent(name) {
const el = document.querySelector(`meta[name="${name}"]`);
return el ? el.getAttribute("content") : null;
}
// 1. DANGEROUS: Never use innerHTML with user input
const userInput = '<img src=x onerror="alert('XSS')">';
// WRONG - vulnerable to XSS
document.getElementById('output').innerHTML = userInput;
<div class="bookmarks">
<h1>Saved Bookmarks</h1>
<table>
<tbody id="bookmarks">
<%= render partial: "bookmark", collection: @bookmarks %>
<%# locals: item %>
<button
type="button"
class="toggle-btn"
data-controller="toggle"
data-action="click->toggle#toggle"
import { Controller } from "@hotwired/stimulus"
import { NotificationsApi } from "notifications_api"
export default class extends Controller {
static targets = ["notification"]
static values = {