Module: Rodauth::InternalRequestMethods

Defined in:
lib/rodauth/features/internal_request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#flashObject (readonly)

Returns the value of attribute flash.



38
39
40
# File 'lib/rodauth/features/internal_request.rb', line 38

def flash
  @flash
end

#internal_request_blockObject

Returns the value of attribute internal_request_block.



39
40
41
# File 'lib/rodauth/features/internal_request.rb', line 39

def internal_request_block
  @internal_request_block
end

#paramsObject

Returns the value of attribute params.



37
38
39
# File 'lib/rodauth/features/internal_request.rb', line 37

def params
  @params
end

#sessionObject

Returns the value of attribute session.



36
37
38
# File 'lib/rodauth/features/internal_request.rb', line 36

def session
  @session
end

Instance Method Details

#add_recovery_codes_viewObject



84
85
86
# File 'lib/rodauth/features/internal_request.rb', line 84

def add_recovery_codes_view
  _return_from_internal_request(recovery_codes)
end

#clear_sessionObject



53
54
55
# File 'lib/rodauth/features/internal_request.rb', line 53

def clear_session
  @session.clear
end

#domainObject



41
42
43
44
45
46
47
# File 'lib/rodauth/features/internal_request.rb', line 41

def domain
  d = super
  if d.nil? || d == INVALID_DOMAIN
    raise InternalRequestError, "must set domain in configuration, as it cannot be determined from internal request"
  end
  d
end

#handle_internal_request(meth) ⇒ Object



106
107
108
109
110
111
112
113
114
115
# File 'lib/rodauth/features/internal_request.rb', line 106

def handle_internal_request(meth)
  catch(:halt) do
    _around_rodauth do
      before_rodauth
      send(meth, request)
    end
  end

  @internal_request_return_value
end

#modifications_require_password?Boolean Also known as: require_login_confirmation?, require_password_confirmation?, change_login_requires_password?, change_password_requires_password?, close_account_requires_password?, two_factor_modifications_require_password?

Returns:

  • (Boolean)


68
69
70
# File 'lib/rodauth/features/internal_request.rb', line 68

def modifications_require_password?
  false
end

#only_json?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/rodauth/features/internal_request.rb', line 117

def only_json?
  false
end

#otp_setup_viewObject



78
79
80
81
82
# File 'lib/rodauth/features/internal_request.rb', line 78

def otp_setup_view
  hash = {:otp_setup=>otp_user_key}
  hash[:otp_setup_raw] = otp_key if hmac_secret
  _return_from_internal_request(hash)
end

#raw_param(k) ⇒ Object



49
50
51
# File 'lib/rodauth/features/internal_request.rb', line 49

def raw_param(k)
  @params[k]
end

#set_error_flash(message) ⇒ Object Also known as: set_redirect_error_flash



57
58
59
60
# File 'lib/rodauth/features/internal_request.rb', line 57

def set_error_flash(message)
  @flash = message
  _handle_internal_request_error
end

#set_notice_flash(message) ⇒ Object Also known as: set_notice_now_flash



63
64
65
# File 'lib/rodauth/features/internal_request.rb', line 63

def set_notice_flash(message)
  @flash = message
end

#webauthn_auth_viewObject



97
98
99
100
101
102
103
104
# File 'lib/rodauth/features/internal_request.rb', line 97

def webauthn_auth_view
  cred = webauthn_credential_options_for_get
  _return_from_internal_request({
    webauthn_auth: cred.as_json,
    webauthn_auth_challenge: cred.challenge,
    webauthn_auth_challenge_hmac: compute_hmac(cred.challenge)
  })
end

#webauthn_setup_viewObject



88
89
90
91
92
93
94
95
# File 'lib/rodauth/features/internal_request.rb', line 88

def webauthn_setup_view
  cred = new_webauthn_credential
  _return_from_internal_request({
    webauthn_setup: cred.as_json,
    webauthn_setup_challenge: cred.challenge,
    webauthn_setup_challenge_hmac: compute_hmac(cred.challenge)
  })
end