adjust templates, add timezone and locale

This commit is contained in:
Alex Turchyn
2023-06-30 01:26:13 +03:00
parent d0c7d449d5
commit c904d51302
47 changed files with 331 additions and 171 deletions
+3 -24
View File
@@ -1,13 +1,11 @@
# frozen_string_literal: true
class ProfileController < ApplicationController
before_action :load_encrypted_config, only: %i[index update_app_url]
def index; end
def update_contact
if current_user.update(contact_params)
redirect_to settings_profile_index_path, notice: 'Contact information successfully updated'
redirect_to settings_profile_index_path, notice: 'Contact information has been updated'
else
render :index, status: :unprocessable_entity
end
@@ -16,17 +14,7 @@ class ProfileController < ApplicationController
def update_password
if current_user.update(password_params)
bypass_sign_in(current_user)
redirect_to settings_profile_index_path, notice: 'Password successfully changed'
else
render :index, status: :unprocessable_entity
end
end
def update_app_url
if @encrypted_config.update(app_url_params)
Docuseal.refresh_default_url_options!
redirect_to settings_profile_index_path, notice: 'App URL successfully changed'
redirect_to settings_profile_index_path, notice: 'Password has been changed'
else
render :index, status: :unprocessable_entity
end
@@ -34,20 +22,11 @@ class ProfileController < ApplicationController
private
def load_encrypted_config
@encrypted_config =
EncryptedConfig.find_or_initialize_by(account: current_account, key: EncryptedConfig::APP_URL_KEY)
end
def contact_params
params.require(:user).permit(:first_name, :last_name, :email, account_attributes: %i[name])
params.require(:user).permit(:first_name, :last_name, :email)
end
def password_params
params.require(:user).permit(:password, :password_confirmation)
end
def app_url_params
params.require(:encrypted_config).permit(:value)
end
end