- 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>
25 lines
780 B
Ruby
25 lines
780 B
Ruby
class InvitationsController < ApplicationController
|
||
before_action :set_user_by_token, only: %i[ edit update ]
|
||
allow_unauthenticated_access
|
||
|
||
def edit
|
||
end
|
||
|
||
def update
|
||
password_params = params.expect(user: [ :password, :password_confirmation ])
|
||
|
||
if @user.update(password_params.merge(invitation_accepted_at: Time.current))
|
||
redirect_to root_path, notice: "Compte activé. Bienvenue !"
|
||
else
|
||
redirect_to invitation_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_invitation_token(params[:token])
|
||
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
||
redirect_to root_path, alert: "Ce lien d’invitation n’est plus valable."
|
||
end
|
||
end
|