module Register
  class RemoteForm < Register::BaseForm
    # login 登陆方式，支持邮箱、登陆、手机号等
    attr_accessor :username, :email, :password, :platform, :user_id

    validates :username, :email, :password, presence: true
    validate :check!
    
    def check!
      user = User.find_by(id: user_id)
      Rails.logger.info "Register::RemoteForm params: id: #{user_id};  username: #{username}; email: #{email}; password: #{password}; platform: #{platform}"
      check_login(username, user)
      check_mail(email,user)
      check_password(password)
    end
  end
end
