mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: only allow CSV file to be uploaded for bulk invite
This commit is contained in:
@@ -6,6 +6,10 @@ export default Em.Component.extend(UploadMixin, {
|
||||
tagName: "span",
|
||||
uploadUrl: "/invites/upload_csv",
|
||||
|
||||
validateUploadedFilesOptions() {
|
||||
return { csvOnly: true };
|
||||
},
|
||||
|
||||
@computed("uploading")
|
||||
uploadButtonText(uploading) {
|
||||
return uploading ? I18n.t("uploading") : I18n.t("user.invited.bulk_invite.text");
|
||||
|
||||
@@ -192,6 +192,11 @@ export function validateUploadedFile(file, opts) {
|
||||
bootbox.alert(I18n.t('post.errors.upload_not_authorized', { authorized_extensions: authorizedImagesExtensions() }));
|
||||
return false;
|
||||
}
|
||||
} else if (opts["csvOnly"]) {
|
||||
if (!(/\.csv$/i).test(name)) {
|
||||
bootbox.alert(I18n.t('user.invited.bulk_invite.error'));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!authorizesAllExtensions() && !isAuthorizedFile(name)) {
|
||||
bootbox.alert(I18n.t('post.errors.upload_not_authorized', { authorized_extensions: authorizedExtensions() }));
|
||||
|
||||
Reference in New Issue
Block a user