Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8463703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:31:46+00:00 2026-06-10T14:31:46+00:00

I want to set up a registration process in which the user initially requests

  • 0

I want to set up a registration process in which the user initially requests more information from the site and then subsequently receives an e-mail containing a link to the actual registration page. The link should be a randomly generated URL, and access to the registration page should be otherwise restricted. In other words, the registration page shouldn’t be accessible by manually typing a URL into the browser.

I would appreciate any advice on how best to implement these features.

I’m new to Rails, so I apologize in advance if this question is basic or if it has already been covered.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T14:31:48+00:00Added an answer on June 10, 2026 at 2:31 pm

    You need to store the random token in a database. Since you are sending it to an email address, you probably want to store the email as well so that you can add it to your User model when they register. Below are some of the relevant parts you can do (although you will need to fill in the gaps).

    Essentially, you need to generate the registration token, with RegistrationToken.new(:email => "their email address"), in a controller.

    This model implements the generation of the random token:

    class RegistrationToken < ActiveRecord::Base
      # the secret is just to make the random number generator more secure
      @@secret = 6345
      def initialize
        # info at http://www.ruby-doc.org/core-1.9.3/Random.html
        seed = Random.new().integer(1000000000) + @@secret
        token = Random.new(seed).integer(1000000000);
        # you might want to generate random numbers larger than 1 billion
        # for more security (maybe with 64 bit integers?)
      end
    end
    

    and a migration for your database:

    class CreateRegistrationTokens
      def change
        create_table :products do |t|
          t.string :email
          t.integer :token
          t.timestamps
        end
      end
    end
    

    Then you just need to setup your controller and view.

    For your registration controller, you just need something like:

    class RegistrationsController < ActiveRecord::Base
      def new
        @registration_token = RegistrationToken.find(params[:token]).first
        if @registration_token.nil?
          raise 'Invalid token' # or whatever you want, eg. redirect to a page
        end
        # otherwise render the registration form (can do implicit render)
      end
      def create
        @registration_token = RegistrationToken.find(params[:token]).first
        if @registration_token.nil?
          raise 'Invalid token' # or whatever you want, eg. redirect to a page
        end
        # otherwise create the user, eg.
        User.create(params[:user].merge(:email => @registration_token.email))
        @registration_token.destroy
      end
    end
    

    The controller actions above essentially makes sure that they can only register if a matching token is found in the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to integrate Paypal within the Devise user registration process. What I want
I am creating a Wordpress website for multi author and want to set user
In a function handling a registration form I want to set the visibility of
I have an existing php website with a user system already set up (registration,
For a registration page where the user enters their contact information and their username
So I have Yii-user and Yii-bootstrap. I want to load the registration form with
I read through the comments here: Is this a reasonable user registration process? but
I want set interfaceOrientation in one UIView as LandscapeLeft and Portrait in other UIView.
i want set the visibility to itemized overlay in map view. if the zoom
I want set Listbox background to transparent but not working Is there any idea?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.