Sha256: a7413e33a9a18e89cc5e865431dbb55b2c321b4d2c66fbcf0e1b4f89a0d2a902

Contents?: true

Size: 496 Bytes

Versions: 1

Compression:

Stored size: 496 Bytes

Contents

class RegistrationsController < ApplicationController
  skip_before_action :authenticate

  def create
    @user = User.new(user_params)

    if @user.save
      session = @user.sessions.create!
      response.set_header "X-Session-Token", session.signed_id

      render json: session, status: :created
    else
      render json: @user.errors, status: :unprocessable_entity
    end
  end

  private
    def user_params
      params.permit(:email, :password, :password_confirmation)
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
authentication-zero-2.12.1 lib/generators/authentication/templates/controllers/api/registrations_controller.rb.tt