Sha256: 022344e78529bef1fb186f971be1a2f7bbcbb69a3a4a4601872a25fe70af8eab
Contents?: true
Size: 790 Bytes
Versions: 8
Compression:
Stored size: 790 Bytes
Contents
class Identity::EmailsController < ApplicationController before_action :set_user def update if !@user.authenticate(params[:current_password]) render json: { error: "The password you entered is incorrect" }, status: :bad_request elsif @user.update(user_params) render_show else render json: @user.errors, status: :unprocessable_entity end end private def set_user @user = Current.user end def user_params params.permit(:email) end def render_show if @user.email_previously_changed? resend_email_verification; render(json: @user) else render json: @user end end def resend_email_verification UserMailer.with(user: @user).email_verification.deliver_later end end
Version data entries
8 entries across 8 versions & 1 rubygems