Tutte le view marketing, legali, viewer, dashboard e admin usano t(); mailer utente-facing e flash localizzati; admin con LocaleResolver e selettore lingua. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.0 KiB
Ruby
31 lines
1.0 KiB
Ruby
module Admin
|
|
class PasswordsController < Admin::BaseController
|
|
def edit
|
|
end
|
|
|
|
def update
|
|
unless current_admin_account.authenticate(params[:current_password])
|
|
flash.now[:alert] = t("admin.flash.password_current_incorrect")
|
|
return render :edit, status: :unprocessable_entity
|
|
end
|
|
|
|
if params[:password].blank? || params[:password].length < 8
|
|
flash.now[:alert] = t("admin.flash.password_too_short")
|
|
return render :edit, status: :unprocessable_entity
|
|
end
|
|
|
|
if params[:password] != params[:password_confirmation]
|
|
flash.now[:alert] = t("admin.flash.password_mismatch")
|
|
return render :edit, status: :unprocessable_entity
|
|
end
|
|
|
|
if current_admin_account.update(password: params[:password])
|
|
redirect_to admin_root_path, notice: t("admin.flash.password_updated")
|
|
else
|
|
flash.now[:alert] = current_admin_account.errors.full_messages.to_sentence
|
|
render :edit, status: :unprocessable_entity
|
|
end
|
|
end
|
|
end
|
|
end
|