Sha256: 6c3a030f25bd939e371f0cb4460f479b96e48e1d7d957e2de973843157382143
Contents?: true
Size: 1.19 KB
Versions: 6
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true require_dependency "decidim/application_controller" module Decidim # The controller to handle the user's account page. class AccountController < ApplicationController helper_method :authorizations include Decidim::UserProfile def show authorize! :show, current_user @account = form(AccountForm).from_model(current_user) end def update authorize! :update, current_user @account = form(AccountForm).from_params(params) UpdateAccount.call(current_user, @account) do on(:ok) do |_account, unconfirmed_email| flash.now[:notice] = if unconfirmed_email t("account.update.success_with_email_confirmation", scope: "decidim") else t("account.update.success", scope: "decidim") end bypass_sign_in(current_user) end on(:invalid) do flash.now[:alert] = t("account.update.error", scope: "decidim") end end render action: :show end private def authorizations @authorizations ||= current_user.authorizations end end end
Version data entries
6 entries across 6 versions & 1 rubygems