lib/generators/authentication/templates/controllers/api/sessions_controller.rb.tt in authentication-zero-2.3.5 vs lib/generators/authentication/templates/controllers/api/sessions_controller.rb.tt in authentication-zero-2.3.6
- old
+ new
@@ -13,13 +13,13 @@
def create
<%= singular_table_name %> = <%= class_name %>.find_by_email(params[:email])
if <%= singular_table_name %> && <%= singular_table_name %>.authenticate(params[:password])
- session = <%= singular_table_name %>.sessions.create!(session_params)
- response.set_header("X-Session-Token", session.signed_id)
+ @session = <%= singular_table_name %>.sessions.create!(session_params)
+ response.set_header("X-Session-Token", @session.signed_id)
- render json: session, status: :created
+ render json: @session, status: :created
else
render json: { error: "That email or password is incorrect" }, status: :unauthorized
end
end