新增:更改邮箱相关接口文档

This commit is contained in:
2022-09-29 13:58:14 +08:00
parent 2cde13eabb
commit 55170c7693
3 changed files with 427 additions and 4 deletions

View File

@@ -1,10 +1,10 @@
class Api::V1::Users::UpdateEmailService < ApplicationService
include ActiveModel::Model
attr_reader :user, :token, :password, :mail, :old_mail, :code, :code_type, :verify_code
attr_reader :user, :token, :password, :mail, :old_mail, :code, :verify_code
attr_accessor :gitea_data
validates :password, :code, :code_type, presence: true
validates :password, :code, presence: true
validates :mail, presence: true, format: { with: CustomRegexp::EMAIL }
def initialize(user, params, token =nil)
@@ -14,8 +14,7 @@ class Api::V1::Users::UpdateEmailService < ApplicationService
@mail = params[:email]
@old_mail = user.mail
@code = params[:code]
@code_type = params[:code_type]
@verify_code = VerificationCode.where(email: @mail, code: @code, code_type: @code_type).last
@verify_code = VerificationCode.where(email: @mail, code: @code, code_type: 10).last
end
def call