Module: Pasaporte::Secure::CheckMethods

Included in:
Controllers::Signon
Defined in:
lib/pasaporte.rb

Instance Method Summary collapse

Instance Method Details

#_redir_to_login_page!(persistables) ⇒ Object

Raises:



106
107
108
109
110
111
112
# File 'lib/pasaporte.rb', line 106

def (persistables)
  @state.merge!(persistables)
  # Prevent Camping from munging our URI with the mountpoint
  @state.msg ||= "First you will need to login"
  LOGGER.info "Suspending #{@nickname} until he is logged in"
  raise PleaseLogin
end

#deny_throttled!Object

Deny throttled users any action

Raises:



124
125
126
# File 'lib/pasaporte.rb', line 124

def deny_throttled!
  raise Throttled if Models::Throttle.throttled?(env)
end

#profile_by_nickname(n) ⇒ Object



144
145
146
# File 'lib/pasaporte.rb', line 144

def profile_by_nickname(n)
  ::Pasaporte::Models::Profile.find_or_create_by_nickname_and_domain_name(n, my_domain)
end

#require_login!(persistables = {}) ⇒ Object

Allow the user to log in. Suspend any variables passed in the session.



115
116
117
118
119
120
121
# File 'lib/pasaporte.rb', line 115

def require_login!(persistables = {})
  deny_throttled!
  raise "No nickname" unless @nickname
  (persistables) unless is_logged_in?
  @profile = profile_by_nickname(@nickname)
  @title = "%s's pasaporte" % @nickname
end

#require_plain!Object

When partial SSL is enabled we use this method to force a plain page

Raises:



134
135
136
# File 'lib/pasaporte.rb', line 134

def require_plain!
  raise RedirectToPlain if PARTIAL_SSL && @env.HTTPS
end

#require_ssl!Object

When partial SSL is enabled we use this method to redirect

Raises:



129
130
131
# File 'lib/pasaporte.rb', line 129

def require_ssl!
  raise RedirectToSSL if PARTIAL_SSL && !@env.HTTPS
end

#validate_token!Object



138
139
140
141
142
# File 'lib/pasaporte.rb', line 138

def validate_token!
 #from = URI.parse(@env.HTTP_REFERER).path
 #LOGGER.debug "Validating form token"
 #token_box.validate!(from, @input.tok)
end