mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 13:39:36 -06:00
Merge pull request #2624 from techAPJ/patch-2
convert space to plus for invite email parameter
This commit is contained in:
commit
4bd6261fcc
@ -63,6 +63,7 @@ class InvitesController < ApplicationController
|
|||||||
def redeem_disposable_invite
|
def redeem_disposable_invite
|
||||||
params.require(:email)
|
params.require(:email)
|
||||||
params.permit(:username, :name, :topic)
|
params.permit(:username, :name, :topic)
|
||||||
|
params[:email] = params[:email].split(' ').join('+')
|
||||||
|
|
||||||
invite = Invite.find_by(invite_key: params[:token])
|
invite = Invite.find_by(invite_key: params[:token])
|
||||||
|
|
||||||
|
@ -252,6 +252,11 @@ describe InvitesController do
|
|||||||
let(:invitee) { Fabricate(:user) }
|
let(:invitee) { Fabricate(:user) }
|
||||||
let(:invite) { Invite.create!(invited_by: invitee) }
|
let(:invite) { Invite.create!(invited_by: invitee) }
|
||||||
|
|
||||||
|
it 'converts "space" to "+" in email parameter' do
|
||||||
|
Invite.expects(:redeem_from_token).with(invite.invite_key, "fname+lname@example.com", nil, nil, topic.id)
|
||||||
|
get :redeem_disposable_invite, email: "fname lname@example.com", token: invite.invite_key, topic: topic.id
|
||||||
|
end
|
||||||
|
|
||||||
it 'redeems the invite' do
|
it 'redeems the invite' do
|
||||||
Invite.expects(:redeem_from_token).with(invite.invite_key, "name@example.com", nil, nil, topic.id)
|
Invite.expects(:redeem_from_token).with(invite.invite_key, "name@example.com", nil, nil, topic.id)
|
||||||
get :redeem_disposable_invite, email: "name@example.com", token: invite.invite_key, topic: topic.id
|
get :redeem_disposable_invite, email: "name@example.com", token: invite.invite_key, topic: topic.id
|
||||||
|
Loading…
Reference in New Issue
Block a user