Class: Chowder::Base
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Chowder::Base
- Defined in:
- lib/chowder.rb
Constant Summary collapse
- LOGIN_VIEW =
" <form action=\"/login\" method=\"POST\">\n Login: <input type=\"text\" name=\"login\" /><br />\n Password: <input type=\"password\" name=\"password\" /><br />\n <input type=\"submit\" value=\"Login\" />\n </form>\n OpenID:\n <form action=\"/openid/initiate\" method=\"POST\">\n URL: <input type=\"text\" name=\"openid_identifier\" /><br />\n <input type=\"submit\" value=\"Login\" />\n </form>\n"
Instance Method Summary collapse
- #authorize(user) ⇒ Object
- #find_login_template ⇒ Object
-
#initialize(app = nil, *args, &block) ⇒ Base
constructor
Override this until in Sinatra supports it.
- #return_or_redirect_to(path) ⇒ Object
Constructor Details
#initialize(app = nil, *args, &block) ⇒ Base
Override this until in Sinatra supports it. See sinatra.lighthouseapp.com/projects/9779/tickets/160
25 26 27 28 |
# File 'lib/chowder.rb', line 25 def initialize(app=nil, *args, &block) @app = app @middleware = OpenStruct.new(:args => args, :block => block) end |
Instance Method Details
#authorize(user) ⇒ Object
30 31 32 |
# File 'lib/chowder.rb', line 30 def (user) session[:current_user] = user end |
#find_login_template ⇒ Object
38 39 40 41 |
# File 'lib/chowder.rb', line 38 def find_login_template views_dir = self..views || "./views" template = Dir[File.join(views_dir, 'login.*')].first end |
#return_or_redirect_to(path) ⇒ Object
34 35 36 |
# File 'lib/chowder.rb', line 34 def return_or_redirect_to(path) redirect(session[:return_to] || path) end |