Class: RegistrationsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RegistrationsController
- Defined in:
- lib/generators/active_registration/templates/registrations_controller.rb
Instance Method Summary collapse
Instance Method Details
#confirm ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/generators/active_registration/templates/registrations_controller.rb', line 18 def confirm @user = User.find_by(confirmation_token: params[:token]) if @user&.confirmation_period_valid? @user.confirm! redirect_to root_path, notice: "Email confirmed!" else redirect_to root_path, alert: "Invalid or expired confirmation link" end end |
#create ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/active_registration/templates/registrations_controller.rb', line 8 def create @user = User.new(user_params) if @user.save ConfirmationMailer.confirmation_instructions(@user).deliver_later redirect_to root_path, notice: "Confirmation email sent!" else render :new end end |
#new ⇒ Object
4 5 6 |
# File 'lib/generators/active_registration/templates/registrations_controller.rb', line 4 def new @user = User.new end |