I'm trying to add email confirmation when signing up users. Users have to fill out a form with their invitation code and email address, and then they get an email with an activation link.
So all I want to do is have it so when the user fills out the form, it submits the form and reloads the form so that it hides and displays the message "we sent you an email, please check and click the link" instead of reloading the entire page.
signup.html.erb
here I've added remote: true
<%= form_tag(form_action, method: :get, remote: true, id: 'create-form') do %>
users_controller.rb
the redirect works but format.js is an unknown format
def new
... code checking params
if @user.user_email_confirmed
render :new
else
respond_to do |format|
format.html { redirect_to signup_path(@user.name, email: @user.email) }
format.js
end
end
new.js.erb
$('#create-form').hide().after('');
$('.login-form').append('<p class="link-sent">We have sent an activation link to the email address you entered - please be sure to check your spam or trash folders. Please click that link to complete account activation.</p>');
not sure what I am missing, any ideas?