retrospring/app/controllers/settings/sharing_controller.rb
Georg Gadinger 606629577a make URI.parse part of the validation for the sharing URL
the regexp alone and web browsers allows URLs to contain non-ASCII
characters, which `URI.parse` does not like -- resulting in the inbox
page to suddenly break.

also changed the `redirect_to` in the controller to a `render :edit` so
that validation errors are shown properly
2023-02-10 20:48:15 +01:00

20 lines
537 B
Ruby

# frozen_string_literal: true
class Settings::SharingController < ApplicationController
before_action :authenticate_user!
def edit; end
def update
user_attributes = params.require(:user).permit(:sharing_enabled,
:sharing_autoclose,
:sharing_custom_url)
if current_user.update(user_attributes)
flash.now[:success] = t(".success")
else
flash.now[:error] = t(".error")
end
render :edit
end
end