Created
December 24, 2012 15:37
-
-
Save volgar1x/4369673 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
def create | |
@errors = [] | |
@user = User.authenticate(params[:username], params[:password]) | |
respond_to do |format| | |
if @user.nil? | |
@errors << t("authentication_error") | |
format.html { render :new } | |
format.json { render json: @errors } | |
else | |
session[:user_id] = @user.id | |
format.html { redirect_to @user, notice: t("authenticated", nickname: @user.nickname) } | |
format.json { render json: @user, location: @user } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment