Sha256: ba0289737c2f7c52c80742cb1c7bb2ceb41a5ae0f4425b4ece3e47e268dc7521
Contents?: true
Size: 905 Bytes
Versions: 6
Compression:
Stored size: 905 Bytes
Contents
class Identity::EmailVerificationsController < ApplicationController skip_before_action :authenticate, only: :edit before_action :set_user, only: :edit def edit @user.update!(verified: true); head(:no_content) end def create UserMailer.with(user: Current.user).email_verification.deliver_later end private def set_user <%- if code_verifiable? -%> verified_user = User.find_by(email: params[:email]) if verified_user && verified_user.verification_code.value == params[:token] @user = verified_user else render json: { error: "That email verification code is invalid" }, status: :bad_request end <%- else -%> @token = EmailVerificationToken.find_signed!(params[:sid]); @user = @token.user rescue render json: { error: "That email verification link is invalid" }, status: :bad_request <%- end -%> end end
Version data entries
6 entries across 6 versions & 1 rubygems