Module: RadiantBasicPageAuthExtension::Page::InstanceMethods
- Defined in:
- lib/radiant-basic_page_auth-extension/page.rb
Instance Method Summary collapse
- #basic_auth_field(name) ⇒ Object
- #basic_auth_pass ⇒ Object
- #basic_auth_realm ⇒ Object
- #basic_auth_user ⇒ Object
- #protected? ⇒ Boolean
Instance Method Details
#basic_auth_field(name) ⇒ Object
47 48 49 |
# File 'lib/radiant-basic_page_auth-extension/page.rb', line 47 def basic_auth_field(name) self.fields.detect { |f| f.name.downcase == name.to_s.downcase } end |
#basic_auth_pass ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/radiant-basic_page_auth-extension/page.rb', line 23 def basic_auth_pass pass = self.basic_auth_field('Password') if pass && pass.content.present? pass.content end end |
#basic_auth_realm ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/radiant-basic_page_auth-extension/page.rb', line 31 def basic_auth_realm realm = self.basic_auth_field('Realm') if realm && realm.content.present? realm = realm.content if realm === 'true' realm = Radiant::Config['site.title'] end realm else realm = self.slug end end |
#basic_auth_user ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/radiant-basic_page_auth-extension/page.rb', line 15 def basic_auth_user user = self.basic_auth_field('User') if user && user.content.present? user.content end end |
#protected? ⇒ Boolean
11 12 13 |
# File 'lib/radiant-basic_page_auth-extension/page.rb', line 11 def protected? self.basic_auth_user && self.basic_auth_pass end |