Include autenticazione, progetti isolati, mail marketing HTML con SMTP, test A/B e editor WYSIWYG. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
552 B
Ruby
22 lines
552 B
Ruby
class PasswordsController < ApplicationController
|
|
def edit
|
|
@user = current_user
|
|
end
|
|
|
|
def update
|
|
@user = current_user
|
|
if @user.authenticate(params[:current_password]) && @user.update(password_params)
|
|
redirect_to root_path, notice: "Password aggiornata."
|
|
else
|
|
flash.now[:alert] = "Impossibile aggiornare la password. Verifica i dati inseriti."
|
|
render :edit, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def password_params
|
|
params.require(:user).permit(:password, :password_confirmation)
|
|
end
|
|
end
|