Rev | Line | |
---|
[7b7d827] | 1 | # Filters added to this controller apply to all controllers in the application. |
---|
| 2 | # Likewise, all the methods added will be available for all controllers. |
---|
| 3 | |
---|
| 4 | class ApplicationController < ActionController::Base |
---|
| 5 | # Pick a unique cookie name to distinguish our session data from others' |
---|
| 6 | session :session_key => '_contact_session_id' |
---|
| 7 | |
---|
| 8 | before_filter :get_contactgroups |
---|
| 9 | |
---|
| 10 | # HACK - do something more advanced here:-) |
---|
[9de3ecc] | 11 | @@magic_password = '' |
---|
[7b7d827] | 12 | |
---|
| 13 | def ApplicationController.application_password |
---|
| 14 | @@magic_password |
---|
| 15 | end |
---|
| 16 | |
---|
| 17 | private |
---|
| 18 | def authorize |
---|
| 19 | unless session[:valid_login] |
---|
| 20 | session[:original_uri] = request.request_uri |
---|
| 21 | # flash[:notice] = "Please log in" |
---|
| 22 | redirect_to(:controller => "login" , :action => "login" ) |
---|
| 23 | end |
---|
| 24 | end |
---|
| 25 | |
---|
| 26 | def get_contactgroups |
---|
| 27 | @contactgroups = Contactgroup.find(:all) |
---|
| 28 | end |
---|
| 29 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.