class SignupController

Public Instance Methods

create() click to toggle source
# File lib/generators/authkit/templates/app/controllers/signup_controller.rb, line 10
def create
  remember = params[:remember_me] == "1"

  @signup = Signup.new(signup_params)

  if @signup.save
    login(@signup.user, remember)
    respond_to do |format|
      format.json { head :no_content }
      format.html {
        redirect_to root_path
      }
    end
  else
    respond_to do |format|
      format.json { render json: { status: 'error', errors: @signup.errors }.to_json, status: 422 }
      format.html { render :new }
    end
  end
end
new() click to toggle source

Create a new Signup form model (found in app/forms/signup.rb)

# File lib/generators/authkit/templates/app/controllers/signup_controller.rb, line 6
def new
  @signup = Signup.new
end

Protected Instance Methods

signup() click to toggle source
# File lib/generators/authkit/templates/app/controllers/signup_controller.rb, line 33
def signup
  @signup
end
signup_params() click to toggle source
# File lib/generators/authkit/templates/app/controllers/signup_controller.rb, line 37
def signup_params
  params.require(:signup).permit(
    :email,
    <% if username? %>:username,
    <% end %>:password,
    :password_confirmation,
    :first_name,
    :last_name,
    :bio,
    :website,
    :phone_number,
    :time_zone)
end