Sha256: 25fc983529854e13715f17b986da719b79952adbb39655d8acae9cc28aa80578

Contents?: true

Size: 695 Bytes

Versions: 7

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

module PUNK
  class VerifySessionAction < Action
    args :session, :secret

    def validate
      validates_not_null :session
      validates_not_empty :session
      return if session.blank?
      validates_not_null :secret
      return if secret.blank?
      validates_type Session, :session
      validates_state :session, :pending
      validates_event :session, :verify
    end

    def process
      verify = ProveClaimService.run(session: session, secret: secret)
      raise BadRequest, 'Secret is incorrect' unless verify.result == true
      present Info, message: 'We have succesfully verified your identity.  Welcome to GroupFire!'
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
punk-0.3.6 lib/punk/actions/sessions/verify.rb
punk-0.3.5 lib/punk/actions/sessions/verify.rb
punk-0.3.4 lib/punk/actions/sessions/verify.rb
punk-0.3.3 lib/punk/actions/sessions/verify.rb
punk-0.3.2 lib/punk/actions/sessions/verify.rb
punk-0.3.1 lib/punk/actions/sessions/verify.rb
punk-0.2.0 lib/punk/actions/sessions/verify.rb