Skip to content

Commit bdf7f21

Browse files
authored
Grab some more public facing lists for lockdown (#2052)
* Fix UI display missing libraries. Post #2048 NOTE: Thank you for whoever you are pointing this out in a very subtle manner.
1 parent 28f624b commit bdf7f21

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

controllers/user.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,14 @@ exports.userCommentListPage = function (aReq, aRes, aNext) {
701701
modelQuery.applyCommentListQueryDefaults(commentListQuery, options, aReq);
702702
commentListQuery.sort('-created');
703703

704+
if (options.authToSearch) {
705+
statusCodePage(aReq, aRes, aNext, {
706+
statusCode: 403, // Forbidden
707+
statusMessage: 'Please Sign In to Search'
708+
});
709+
return;
710+
}
711+
704712
// commentListQuery: Pagination
705713
pagination = options.pagination; // is set in modelQuery.apply___ListQueryDefaults
706714

@@ -711,7 +719,7 @@ exports.userCommentListPage = function (aReq, aRes, aNext) {
711719
});
712720

713721
// SearchBar
714-
options.searchBarPlaceholder = 'Search Comments from ' + user.name;
722+
options.searchBarPlaceholder = options.authRequired + 'Search Comments from ' + user.name;
715723
options.searchBarFormAction = '';
716724

717725
//--- Tasks
@@ -885,12 +893,20 @@ exports.userScriptListPage = function (aReq, aRes, aNext) {
885893
modelQuery.applyScriptListQueryDefaults(scriptListQuery, options, aReq);
886894
}
887895

896+
if (options.authToSearch) {
897+
statusCodePage(aReq, aRes, aNext, {
898+
statusCode: 403, // Forbidden
899+
statusMessage: 'Please Sign In to Search'
900+
});
901+
return;
902+
}
903+
888904
// scriptListQuery: Pagination
889905
pagination = options.pagination; // is set in modelQuery.apply___ListQueryDefaults
890906

891907
// SearchBar
892-
options.searchBarPlaceholder = 'Search ' +
893-
(options.librariesOnly ? 'Libraries' : 'Scripts') + ' from ' + user.name;
908+
options.searchBarPlaceholder = options.authRequired + 'Search ' +
909+
(librariesOnly ? 'Libraries' : 'Scripts') + ' from ' + user.name;
894910
options.searchBarFormAction = '';
895911

896912
//--- Tasks

0 commit comments

Comments
 (0)