From 0c237b19fdf9c614293c1442f0ab95a81ce05735 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 22 Jun 2018 15:42:55 +0200 Subject: Fix images size limit --- .../my-account-settings/my-account-settings.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'client/src/app/+my-account/my-account-settings/my-account-settings.component.ts') diff --git a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts index 15f977e58..14293f14c 100644 --- a/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts +++ b/client/src/app/+my-account/my-account-settings/my-account-settings.component.ts @@ -50,6 +50,10 @@ export class MyAccountSettingsComponent implements OnInit { changeAvatar () { const avatarfile = this.avatarfileInput.nativeElement.files[ 0 ] + if (avatarfile.size > this.maxAvatarSize) { + this.notificationsService.error('Error', 'This image is too large.') + return + } const formData = new FormData() formData.append('avatarfile', avatarfile) @@ -59,7 +63,7 @@ export class MyAccountSettingsComponent implements OnInit { data => { this.notificationsService.success(this.i18n('Success'), this.i18n('Avatar changed.')) - this.user.account.avatar = data.avatar + this.user.updateAccountAvatar(data.avatar) }, err => this.notificationsService.error(this.i18n('Error'), err.message) -- cgit v1.2.3