module API module V2 module Account module Utils def session request.session end def publish_confirmation_code(user, action) totp = ::Vault::TOTPAction.new(action) totp.create(user.uid, user.email) ::EventAPI.notify(action, record: { user: user.as_json_for_event_api, domain: Peatio::App.config.domain, code: totp.read_code(user.uid) }) end end end end end