lib/generators/authentication/templates/controllers/html/passwords_controller.rb.tt in authentication-zero-2.16.36 vs lib/generators/authentication/templates/controllers/html/passwords_controller.rb.tt in authentication-zero-3.0.0.alpha1
- old
+ new
@@ -3,13 +3,11 @@
def edit
end
def update
- if !@user.authenticate(params[:current_password])
- redirect_to edit_password_path, alert: "The current password you entered is incorrect"
- elsif @user.update(user_params)
+ if @user.update(user_params)
redirect_to root_path, notice: "Your password has been changed"
else
render :edit, status: :unprocessable_entity
end
end
@@ -18,8 +16,8 @@
def set_user
@user = Current.user
end
def user_params
- params.permit(:password, :password_confirmation)
+ params.permit(:password, :password_confirmation, :password_challenge).with_defaults(password_challenge: "")
end
end