Module: Account::Onboarding::UserEmail::ControllerBase
- Extended by:
- ActiveSupport::Concern
- Included in:
- Account::Onboarding::UserEmailController
- Defined in:
- app/controllers/concerns/account/onboarding/user_email/controller_base.rb
Instance Method Summary collapse
-
#edit ⇒ Object
GET /users/1/edit.
-
#update ⇒ Object
PATCH/PUT /users/1 PATCH/PUT /users/1.json.
Instance Method Details
#edit ⇒ Object
GET /users/1/edit
15 16 17 18 19 20 |
# File 'app/controllers/concerns/account/onboarding/user_email/controller_base.rb', line 15 def edit flash[:notice] = nil if @user.email_is_oauth_placeholder? @user.email = nil end end |
#update ⇒ Object
PATCH/PUT /users/1 PATCH/PUT /users/1.json
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/concerns/account/onboarding/user_email/controller_base.rb', line 24 def update respond_to do |format| if @user.update(user_params) # if you update your own user account, devise will normally kick you out, so we do this instead. bypass_sign_in current_user.reload if !@user.email_is_oauth_placeholder? @user.send_welcome_email format.html { redirect_to account_team_path(@user.teams.first), notice: "" } else format.html { flash[:error] = I18n.t("global.notifications.all_fields_required") redirect_to edit_account_onboarding_user_detail_path(@user) } end format.json { render :show, status: :ok, location: [:account, @user] } else # this is just checking whether the error on the email field is taking the email # address is already taken. @email_taken = begin @user.errors.details[:email].select { |error| error[:error] == :taken }.any? rescue false end format.html { render :edit, status: :unprocessable_entity } format.json { render json: @user.errors, status: :unprocessable_entity } end end end |