27 lines
519 B
Ruby
27 lines
519 B
Ruby
# frozen_string_literal: true
|
|
|
|
class PasswordsController < ApplicationController
|
|
def edit
|
|
@user = Current.user
|
|
end
|
|
|
|
def update
|
|
if Current.user.update!(password_params)
|
|
redirect_to Current.user, notice: t(".success")
|
|
else
|
|
flash.now[:alert] = t(".error")
|
|
render :edit, status: :unprocessable_entity
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def password_params
|
|
params.require(:user).permit(
|
|
:password_challenge,
|
|
:password,
|
|
:password_confirmation,
|
|
)
|
|
end
|
|
end
|