mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
Use POST for send_activation_email action
This commit is contained in:
parent
a0f07f8914
commit
84ce04dfa5
4 changed files with 7 additions and 7 deletions
|
@ -204,7 +204,7 @@ Discourse.AdminUser = Discourse.User.extend({
|
|||
},
|
||||
|
||||
sendActivationEmail: function() {
|
||||
Discourse.ajax('/users/' + this.get('username') + '/send_activation_email').then(function() {
|
||||
Discourse.ajax('/users/' + this.get('username') + '/send_activation_email', {type: 'POST'}).then(function() {
|
||||
// succeeded
|
||||
bootbox.alert( Em.String.i18n('admin.user.activation_email_sent') );
|
||||
}, function(e) {
|
||||
|
|
|
@ -11,7 +11,7 @@ Discourse.NotActivatedController = Discourse.Controller.extend(Discourse.ModalFu
|
|||
emailSent: false,
|
||||
|
||||
sendActivationEmail: function() {
|
||||
Discourse.ajax('/users/' + this.get('username') + '/send_activation_email');
|
||||
Discourse.ajax('/users/' + this.get('username') + '/send_activation_email', {type: 'POST'});
|
||||
this.set('emailSent', true);
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ Discourse::Application.routes.draw do
|
|||
put 'users/:username/preferences/username' => 'users#username', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get 'users/:username/avatar(/:size)' => 'users#avatar', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get 'users/:username/invited' => 'users#invited', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
get 'users/:username/send_activation_email' => 'users#send_activation_email', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
post 'users/:username/send_activation_email' => 'users#send_activation_email', constraints: {username: USERNAME_ROUTE_FORMAT}
|
||||
|
||||
resources :uploads
|
||||
|
||||
|
|
|
@ -887,7 +887,7 @@ describe UsersController do
|
|||
context 'with a valid email_token' do
|
||||
it 'should send the activation email' do
|
||||
Jobs.expects(:enqueue).with(:user_email, has_entries(type: :signup))
|
||||
xhr :get, :send_activation_email, username: user.username
|
||||
xhr :post, :send_activation_email, username: user.username
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -899,13 +899,13 @@ describe UsersController do
|
|||
|
||||
it 'should generate a new token' do
|
||||
expect {
|
||||
xhr :get, :send_activation_email, username: user.username
|
||||
xhr :post, :send_activation_email, username: user.username
|
||||
}.to change{ user.email_tokens(true).count }.by(1)
|
||||
end
|
||||
|
||||
it 'should send an email' do
|
||||
Jobs.expects(:enqueue).with(:user_email, has_entries(type: :signup))
|
||||
xhr :get, :send_activation_email, username: user.username
|
||||
xhr :post, :send_activation_email, username: user.username
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -913,7 +913,7 @@ describe UsersController do
|
|||
context 'when username does not exist' do
|
||||
it 'should not send an email' do
|
||||
Jobs.expects(:enqueue).never
|
||||
xhr :get, :send_activation_email, username: 'nopenopenopenope'
|
||||
xhr :post, :send_activation_email, username: 'nopenopenopenope'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue