mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 03:10:46 -06:00
FEATURE: invite_code is case-insensitive
Previously we required exact casing for invite code, this can cause a lot of confusion. Relax the requirement.
This commit is contained in:
parent
b2aa203e67
commit
ecbccab159
@ -425,7 +425,7 @@ class UsersController < ApplicationController
|
||||
return fail_with("login.email_too_long")
|
||||
end
|
||||
|
||||
if SiteSetting.require_invite_code && SiteSetting.invite_code != params[:invite_code]
|
||||
if SiteSetting.require_invite_code && SiteSetting.invite_code.strip.downcase != params[:invite_code].strip.downcase
|
||||
return fail_with("login.wrong_invite_code")
|
||||
end
|
||||
|
||||
|
@ -1529,7 +1529,7 @@ en:
|
||||
markdown_typographer_quotation_marks: "List of double and single quotes replacement pairs"
|
||||
post_undo_action_window_mins: "Number of minutes users are allowed to undo recent actions on a post (like, flag, etc)."
|
||||
must_approve_users: "Staff must approve all new user accounts before they are allowed to access the site."
|
||||
invite_code: "User must type this code to be allowed account registration, ignored when empty"
|
||||
invite_code: "User must type this code to be allowed account registration, ignored when empty (case-insensitive)"
|
||||
approve_suspect_users: "Add suspicious users to the review queue. Suspicious users have entered a bio/website but have no reading activity."
|
||||
pending_users_reminder_delay: "Notify moderators if new users have been waiting for approval for longer than this many hours. Set to -1 to disable notifications."
|
||||
maximum_session_age: "User will remain logged in for n hours since last visit"
|
||||
|
@ -618,7 +618,7 @@ describe UsersController do
|
||||
|
||||
it 'requires invite code when specified' do
|
||||
expect(SiteSetting.require_invite_code).to eq(false)
|
||||
SiteSetting.invite_code = "abc"
|
||||
SiteSetting.invite_code = "abc def"
|
||||
expect(SiteSetting.require_invite_code).to eq(true)
|
||||
|
||||
post_user(invite_code: "abcd")
|
||||
@ -626,7 +626,8 @@ describe UsersController do
|
||||
json = JSON.parse(response.body)
|
||||
expect(json["success"]).to eq(false)
|
||||
|
||||
post_user(invite_code: "abc")
|
||||
# case insensitive and stripped of leading/ending spaces
|
||||
post_user(invite_code: " AbC deF ")
|
||||
expect(response.status).to eq(200)
|
||||
json = JSON.parse(response.body)
|
||||
expect(json["success"]).to eq(true)
|
||||
|
Loading…
Reference in New Issue
Block a user