mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:13:47 +08:00
FIX: allow retry activation of account by username or password
This commit is contained in:
parent
c4fb7dce23
commit
8f8ea735ee
|
@ -266,7 +266,7 @@ Discourse.AdminUser = Discourse.User.extend({
|
|||
},
|
||||
|
||||
sendActivationEmail: function() {
|
||||
Discourse.ajax('/users/' + this.get('username') + '/send_activation_email', {type: 'POST'}).then(function() {
|
||||
Discourse.ajax('/users/action/send_activation_email', {data: {username: this.get('username')}, type: 'POST'}).then(function() {
|
||||
// succeeded
|
||||
bootbox.alert( I18n.t('admin.user.activation_email_sent') );
|
||||
}, function(e) {
|
||||
|
|
|
@ -7,7 +7,7 @@ export default DiscourseController.extend(ModalFunctionality, {
|
|||
|
||||
actions: {
|
||||
sendActivationEmail: function() {
|
||||
Discourse.ajax('/users/' + this.get('username') + '/send_activation_email', {type: 'POST'});
|
||||
Discourse.ajax('/users/action/send_activation_email', {data: {username: this.get('username')}, type: 'POST'});
|
||||
this.set('emailSent', true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,7 +325,11 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def send_activation_email
|
||||
@user = fetch_user_from_params(include_inactive: true)
|
||||
|
||||
RateLimiter.new(nil, "activate-hr-#{request.remote_ip}", 30, 1.hour).performed!
|
||||
RateLimiter.new(nil, "activate-min-#{request.remote_ip}", 6, 1.minute).performed!
|
||||
|
||||
@user = User.find_by_username_or_email(params[:username].to_s)
|
||||
@email_token = @user.email_tokens.unconfirmed.active.first
|
||||
enqueue_activation_email if @user
|
||||
render nothing: true
|
||||
|
|
|
@ -232,7 +232,7 @@ Discourse::Application.routes.draw do
|
|||
delete "users/:username/preferences/user_image" => "users#destroy_user_image", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
put "users/:username/preferences/avatar/pick" => "users#pick_avatar", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get "users/:username/invited" => "users#invited", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
post "users/:username/send_activation_email" => "users#send_activation_email", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
post "users/action/send_activation_email" => "users#send_activation_email"
|
||||
get "users/:username/activity" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get "users/:username/activity/:filter" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get "users/:username/badges" => "users#show", constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
|
|
Loading…
Reference in New Issue
Block a user