Bal Jassal
Bal Jassal

Reputation: 11

Multi stage sign up process with rails and devise

I want to create a multi-step sign-up procedure using rails and devise.

Step one, visitors can sign up with email, password and password confirmation. Email address would need to verified.

Step two, Upon successful email verification I would like to direct the new user to an additional form which would require them to add a username and zip code/postcode. Once this is complete redirect the user to their profile.

Can anyone help explain how this can be done with Devise? or maybe even a tutorial I can follow.

Thanks for reading

Upvotes: 1

Views: 711

Answers (2)

willrbot
willrbot

Reputation: 1

You could add a state machine to record the user's current state. For example, if you have a multi-onboarding sign up flow, for each step in the onboarding process, you could add a different state once they have moved on (e.g., page 1, page 2, page 3, etc). You could even use a gem like AASM - Ruby state machines: https://github.com/aasm/aasm

Upvotes: 0

hedin
hedin

Reputation: 1024

Devise has :confirmable flag for this.

# models/user.rb
devise :registerable, :confirmable

Also, you will need add this fields to model:

# db/migrate/XXXXXXX_devise_migration.rb
# Confirmable
t.string   :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
t.string   :unconfirmed_email # Only if using reconfirmable

For more information, please read this section of Devise documentation.

Upvotes: 1

Related Questions