Created
January 3, 2014 01:15
-
-
Save patmaddox/8230726 to your computer and use it in GitHub Desktop.
for Casey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ApplicationController | |
| def require_login | |
| unless current_user | |
| session[:return_to] = request.uri | |
| redirect_to login_path | |
| end | |
| end | |
| end | |
| class LoginsController | |
| def create | |
| if user = User.authenticate(params[:username], params[:password]) | |
| session[:current_user_id] = user.id | |
| redirect_to(session.delete(:return_to) || home_path) | |
| else | |
| render template: 'login' | |
| end | |
| end | |
| end | |
| class FlowLogsController | |
| before_filter :require_login | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment