Skip to content

Commit aadbd84

Browse files
Pytalnextcloud-command
authored andcommitted
Improve handling of profile fields
Signed-off-by: Christopher Ng <[email protected]> (cherry picked from commit a94c5fb) Signed-off-by: nextcloud-command <[email protected]>
1 parent c1f3385 commit aadbd84

36 files changed

+174
-112
lines changed

apps/provisioning_api/lib/Controller/UsersController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ public function getEditableFieldsForUser(string $userId): DataResponse {
627627
* @NoAdminRequired
628628
* @NoSubAdminRequired
629629
* @PasswordConfirmationRequired
630+
* @UserRateThrottle(limit=5, period=60)
630631
*
631632
* @throws OCSException
632633
*/
@@ -719,6 +720,7 @@ public function editUserMultiValue(
719720
* @NoAdminRequired
720721
* @NoSubAdminRequired
721722
* @PasswordConfirmationRequired
723+
* @UserRateThrottle(limit=50, period=600)
722724
*
723725
* edit users
724726
*

apps/settings/js/federationsettingsview.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@
164164
} else {
165165
self._showInputChangeFail(field);
166166
}
167+
}).fail(function(data) {
168+
if (data.status === 429) {
169+
OC.Notification.showTemporary(t('settings', 'There were too many requests from your network. Retry later or contact your administrator if this is an error.'))
170+
}
167171
});
168172
},
169173

@@ -181,7 +185,12 @@
181185
$('#' + field + 'scope').val(scope);
182186

183187
// TODO: user loading/success feedback
184-
this._config.save();
188+
var savingData = this._config.save();
189+
$.when(savingData).fail(function(data) {
190+
if (data.status === 429) {
191+
OC.Notification.showTemporary(t('settings', 'There were too many requests from your network. Retry later or contact your administrator if this is an error.'))
192+
}
193+
});
185194
this._setFieldScopeIcon(field, scope);
186195
this._updateVerifyButton(field, scope);
187196
},

apps/settings/js/settings/personalInfo.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ window.addEventListener('DOMContentLoaded', function () {
248248
var selectedLocale = $("#localeinput").val(),
249249
user = OC.getCurrentUser();
250250

251+
var errorMessage = t('settings', 'An error occurred while changing your locale. Please reload the page and try again.')
252+
251253
$.ajax({
252254
url: OC.linkToOCS('cloud/users', 2) + user.uid,
253255
method: 'PUT',
@@ -259,8 +261,14 @@ window.addEventListener('DOMContentLoaded', function () {
259261
moment.locale(selectedLocale);
260262
},
261263
fail: function() {
262-
OC.Notification.showTemporary(t('settings', 'An error occurred while changing your locale. Please reload the page and try again.'));
263-
}
264+
OC.Notification.showTemporary(errorMessage);
265+
},
266+
error: function(xhr) {
267+
if (xhr.status === 429) {
268+
errorMessage += '\n' + t('settings', 'There were too many requests from your network. Retry later or contact your administrator if this is an error.')
269+
}
270+
OC.Notification.showTemporary(errorMessage)
271+
},
264272
});
265273
};
266274
$("#localeinput").change(updateLocale);

apps/settings/js/vue-settings-admin-basic-settings.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/settings/js/vue-settings-admin-basic-settings.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/settings/js/vue-settings-admin-delegation.js

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/settings/js/vue-settings-admin-delegation.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/settings/js/vue-settings-admin-security.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/settings/js/vue-settings-admin-security.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/settings/js/vue-settings-apps-users-management.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)