Sha256: ce8697e05b781dfeeb5c2f2e6fe98bf16a8da4fe208b07dac97f25773fd65693

Contents?: true

Size: 718 Bytes

Versions: 36

Compression:

Stored size: 718 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 }

      send_email_verification
      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

    def send_email_verification
      UserMailer.with(user: @user).email_verification.deliver_later
    end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
authentication-zero-2.16.28 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.27 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.26 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.25 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.24 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.23 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.22 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.21 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.20 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.19 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.18 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.17 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.16 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.15 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.14 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.13 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.12 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.11 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.10 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt
authentication-zero-2.16.9 lib/generators/authentication/templates/controllers/html/registrations_controller.rb.tt