Sha256: bdb8bba0f81c02b1781cd8f2b4496a484a3e39b2609fb9600c6e61a1505baa73

Contents?: true

Size: 579 Bytes

Versions: 12

Compression:

Stored size: 579 Bytes

Contents

class RegistrationsController < ApplicationController
  skip_before_action :authenticate

  def new
    @user = User.new
  end

  def create
    @user = User.new(user_params)

    if @user.save
      session = @user.sessions.create!
      cookies.signed.permanent[:session_token] = { value: session.id, httponly: true }

      redirect_to root_path, notice: "Welcome! You have signed up successfully"
    else
      render :new, status: :unprocessable_entity
    end
  end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
authentication-zero-2.15.2 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.15.1 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.15.0 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.14.0 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.13.0 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.12.6 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.12.5 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.12.4 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.12.3 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.12.2 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.12.1 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.12.0 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt