From 46ca66771be750305a3437f09773465c6f6a649b Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Tue, 27 Oct 2015 16:25:30 -0400 Subject: [PATCH] FIX: Better error message for resending activation. Don't limit staff. --- app/assets/javascripts/admin/models/admin-user.js.es6 | 5 +---- app/controllers/users_controller.rb | 6 ++++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/admin/models/admin-user.js.es6 b/app/assets/javascripts/admin/models/admin-user.js.es6 index 1e83de62065..20a9579bd62 100644 --- a/app/assets/javascripts/admin/models/admin-user.js.es6 +++ b/app/assets/javascripts/admin/models/admin-user.js.es6 @@ -288,10 +288,7 @@ const AdminUser = Discourse.User.extend({ data: { username: this.get('username') } }).then(function() { bootbox.alert( I18n.t('admin.user.activation_email_sent') ); - }).catch(function(e) { - var error = I18n.t('admin.user.send_activation_email_failed', { error: "http: " + e.status + " - " + e.body }); - bootbox.alert(error); - }); + }).catch(popupAjaxError); }, anonymizeForbidden: Em.computed.not("can_be_anonymized"), diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index eb28b8cb18c..12abf12a97f 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -498,8 +498,10 @@ class UsersController < ApplicationController end def send_activation_email - RateLimiter.new(nil, "activate-hr-#{request.remote_ip}", 30, 1.hour).performed! - RateLimiter.new(nil, "activate-min-#{request.remote_ip}", 6, 1.minute).performed! + if current_user.blank? || !current_user.staff? + RateLimiter.new(nil, "activate-hr-#{request.remote_ip}", 30, 1.hour).performed! + RateLimiter.new(nil, "activate-min-#{request.remote_ip}", 6, 1.minute).performed! + end @user = User.find_by_username_or_email(params[:username].to_s)