Sha256: 1a6a5ad071e26b636723d3a3d17c39422ef94ceac1ddaf984f68dd5458234521

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

module Nyauth
  class RegistrationsController < ApplicationController
    include Nyauth::ApplicationConcern
    include Nyauth::ClientConcern
    allow_everyone
    self.responder = Nyauth::AppResponder
    respond_to :html, :json
    before_action :set_client

    def new
    end

    def create
      sign_in(@client) if @client.save
      respond_with(@client, location: Nyauth.configuration.redirect_path_after_registration.call(client_name) || main_app.root_path)
    end

    private

    def set_client
      @client = client_class.new(client_params)
    end

    def client_params
      params.fetch(client_name, {})
            .permit(:email, :password, :password_confirmation)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nyauth-0.2.8 app/controllers/nyauth/registrations_controller.rb
nyauth-0.2.7 app/controllers/nyauth/registrations_controller.rb