Created
August 6, 2010 21:24
-
-
Save benlangfeld/512035 to your computer and use it in GitHub Desktop.
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
POST /user_sessions HTTP/1.1 | |
Content-Type: application/json | |
{"username":"admin","password":"test","remember":true} |
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
HTTP/1.1 200 OK | |
Etag: "7666ae547899c0ffa16acfd66371c76e" | |
Connection: close | |
Content-Type: text/html; charset=utf-8 | |
Date: Fri, 06 Aug 2010 21:21:22 GMT | |
Server: WEBrick/1.3.1 (Ruby/1.8.7/2010-04-19) | |
X-Runtime: 0.171651 | |
Content-Length: 3245 | |
Cache-Control: max-age=0, private, must-revalidate |
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 UserSessionsController < ApplicationController | |
filter_resource_access | |
layout "login" | |
ssl_required :new, :create if Settings.ssl | |
respond_to :html, :xml, :json | |
def new | |
respond_with @user_session = UserSession.new | |
end | |
def create | |
@user_session = UserSession.new params[:user_session] | |
if @user_session.save | |
flash[:notice] = "Successfully logged in." | |
end | |
respond_with @user_session#, :location => root_url | |
end | |
def destroy | |
@user_session = UserSession.find | |
@user_session.destroy | |
flash[:notice] = "Sucessfully logged out." | |
redirect_to root_url | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment