summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-23 13:15:08 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-23 13:15:08 +0200
commitd881a3c37b627fa5b5de282df93be3af93ff829c (patch)
tree0b407617ad384f4af323e2cc03e50613ea723dc3 /settings/js
parenta596251d6b8b27ad5ea626d1939adab6866dfe61 (diff)
downloadnextcloud-server-d881a3c37b627fa5b5de282df93be3af93ff829c.tar.gz
nextcloud-server-d881a3c37b627fa5b5de282df93be3af93ff829c.zip
adapt to force language changes
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/settings/personalInfo.js38
1 files changed, 23 insertions, 15 deletions
diff --git a/settings/js/settings/personalInfo.js b/settings/js/settings/personalInfo.js
index 9496f65a8f3..306994a7094 100644
--- a/settings/js/settings/personalInfo.js
+++ b/settings/js/settings/personalInfo.js
@@ -259,23 +259,31 @@ $(document).ready(function () {
});
federationSettingsView.render();
- $("#languageinput").change(function () {
- // Serialize the data
- var post = $("#languageinput").serialize();
- // Ajax foo
- $.ajax(
- 'ajax/setlanguage.php',
- {
- method: 'POST',
- data: post
+ var updateLanguage = function () {
+ if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
+ OC.PasswordConfirmation.requirePasswordConfirmation(updateLanguage);
+ return;
+ }
+
+ var selectedLang = $("#languageinput").val(),
+ user = OC.getCurrentUser();
+
+ $.ajax({
+ url: OC.linkToOCS('cloud/users', 2) + user['uid'],
+ method: 'PUT',
+ data: {
+ key: 'language',
+ value: selectedLang
+ },
+ success: function() {
+ location.reload();
+ },
+ fail: function() {
+ OC.Notification.showTemporary(t('settings', 'An error occured while changing your language. Please reload the page and try again.'));
}
- ).done(function() {
- location.reload();
- }).fail(function(jqXHR) {
- $('#passworderror').text(jqXHR.responseJSON.message);
});
- return false;
- });
+ };
+ $("#languageinput").change(updateLanguage);
var uploadparms = {
pasteZone: null,