Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move email confirm from update to new user #763

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,8 @@ def update
@user.update_profile!(params)

unless @user.errors.any?
unless @user.email.blank? || @user.email_confirmed
Notifier.send_confirm_email_notification(@user.email, @user.create_token)
flash[:notice] = "A link to confirm your updated email address has been sent to #{@user.email}."
else
flash[:notice] = "Profile saved!"
end
flash[:notice] = "Profile saved!"
end

redirect_to user_path(@user)
else
Expand Down Expand Up @@ -99,7 +95,11 @@ def create

if @user.save
Authorization.create_from_session!(session, @user)

unless @user.email.blank? || @user.email_confirmed
Notifier.send_confirm_email_notification(@user.email, @user.create_token)
flash[:notice] = "Thanks! You're all signed up with #{@user.username} for your username. A link to confirm your updated email address has been sent to #{@user.email}."
end

flash[:notice] = "Thanks! You're all signed up with #{@user.username} for your username."
sign_in(@user)
redirect_to root_path
Expand Down