app.kluk.fr/app/controllers/passwords_controller.rb
Christophe Robillard 7a7fa4c095
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run
redesign app on top of the kluk.fr charte
- drop Bulma and Font Awesome, plain CSS built on charte.css
- dashboard: GitHub-like calendar grouped by year, selected day panel
  (sticky side column on desktop, bottom bar on mobile), keyboard navigation
- public page: today's mood and last months fit in one screen, journal hidden
- day log page: mode picker as pills, illustration follows the chosen mode
- login, password and invitation screens in French, global flash messages
- add User#current_mode_since

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 07:35:53 +02:00

33 lines
1 KiB
Ruby
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class PasswordsController < ApplicationController
allow_unauthenticated_access
before_action :set_user_by_token, only: %i[ edit update ]
def new
end
def create
if user = User.find_by(email_address: params[:email_address])
PasswordsMailer.reset(user).deliver_later
end
redirect_to new_session_path, notice: "Si un compte existe avec cette adresse, un lien pour changer de mot de passe vient de lui être envoyé."
end
def edit
end
def update
if @user.update(params.permit(:password, :password_confirmation))
redirect_to new_session_path, notice: "Mot de passe changé. Vous pouvez vous connecter."
else
redirect_to edit_password_path(params[:token]), alert: "Les deux mots de passe ne sont pas identiques."
end
end
private
def set_user_by_token
@user = User.find_by_password_reset_token!(params[:token])
rescue ActiveSupport::MessageVerifier::InvalidSignature
redirect_to new_password_path, alert: "Ce lien n’est plus valable. Demandez-en un nouveau."
end
end