summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
Diffstat (limited to 'settings')
-rw-r--r--settings/js/personal.js34
-rw-r--r--settings/templates/personal.php2
2 files changed, 34 insertions, 2 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js
index ac18f525809..9e4dd54090d 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -234,6 +234,20 @@ $(document).ready(function () {
var uploadparms = {
done: function (e, data) {
avatarResponseHandler(data.result);
+ },
+ fail: function (e, data){
+ var msg = data.jqXHR.statusText + ' (' + data.jqXHR.status + ')';
+ if (!_.isUndefined(data.jqXHR.responseJSON) &&
+ !_.isUndefined(data.jqXHR.responseJSON.data) &&
+ !_.isUndefined(data.jqXHR.responseJSON.data.message)
+ ) {
+ msg = data.jqXHR.responseJSON.data.message;
+ }
+ avatarResponseHandler({
+ data: {
+ message: t('settings', 'An error occurred: {message}', { message: msg })
+ }
+ });
}
};
@@ -247,7 +261,25 @@ $(document).ready(function () {
OC.dialogs.filepicker(
t('settings', "Select a profile picture"),
function (path) {
- $.post(OC.generateUrl('/avatar/'), {path: path}, avatarResponseHandler);
+ $.ajax({
+ type: "POST",
+ url: OC.generateUrl('/avatar/'),
+ data: { path: path }
+ }).done(avatarResponseHandler)
+ .fail(function(jqXHR, status){
+ var msg = jqXHR.statusText + ' (' + jqXHR.status + ')';
+ if (!_.isUndefined(jqXHR.responseJSON) &&
+ !_.isUndefined(jqXHR.responseJSON.data) &&
+ !_.isUndefined(jqXHR.responseJSON.data.message)
+ ) {
+ msg = jqXHR.responseJSON.data.message;
+ }
+ avatarResponseHandler({
+ data: {
+ message: t('settings', 'An error occurred: {message}', { message: msg })
+ }
+ });
+ });
},
false,
["image/png", "image/jpeg"]
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 02ee261cd1d..e7832b85ebd 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -159,7 +159,7 @@ if($_['passwordChangeSupported']) {
<input type="file" class="hidden" name="files[]" id="uploadavatar">
<div class="inlineblock button" id="selectavatar"><?php p($l->t('Select new from Files')); ?></div>
<div class="inlineblock button" id="removeavatar"><?php p($l->t('Remove image')); ?></div><br>
- <?php p($l->t('Either png or jpg. Ideally square but you will be able to crop it.')); ?>
+ <?php p($l->t('Either png or jpg. Ideally square but you will be able to crop it. The file is not allowed to exceed the maximum size of 20 MB.')); ?>
<?php else: ?>
<?php p($l->t('Your avatar is provided by your original account.')); ?>
<?php endif; ?>