don't allow other users or confirmed users to resend confirmation email

This commit is contained in:
jomo
2016-06-21 23:35:41 +02:00
parent 3f91e1a099
commit e0ac5fac13

View File

@@ -139,8 +139,12 @@ class UsersController < ApplicationController
end
def resend_mail
RedstonerMailer.register_mail(@user, false).deliver_now
flash[:notice] = "Check your inbox for the confirmation mail."
if @user.is?(current_user) && !confirmed?
RedstonerMailer.register_mail(@user, false).deliver_now
flash[:notice] = "Check your inbox for the confirmation mail."
else
flash[:alert] = "You're not allowed to resend this user's confirmation email"
end
redirect_to user_path(@user)
end