Restrict avatar filetypes
This commit is contained in:
parent
ef43721e32
commit
d1a9561135
1 changed files with 13 additions and 0 deletions
|
@ -6,6 +6,19 @@ import ProgressDialog from '../views/components/progress-dialog.vue';
|
||||||
export default (os: OS) => {
|
export default (os: OS) => {
|
||||||
|
|
||||||
const cropImage = file => new Promise((resolve, reject) => {
|
const cropImage = file => new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
var regex = RegExp('\.(jpg|jpeg|png|gif|webp|bmp|tiff)$')
|
||||||
|
if(!regex.test(file.name) ) {
|
||||||
|
os.apis.dialog({
|
||||||
|
title: '%fa:info-circle% %i18n:desktop.invalid-filetype%',
|
||||||
|
text: null,
|
||||||
|
actions: [{
|
||||||
|
text: '%i18n:common.got-it%'
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
reject
|
||||||
|
}
|
||||||
|
|
||||||
const w = os.new(CropWindow, {
|
const w = os.new(CropWindow, {
|
||||||
image: file,
|
image: file,
|
||||||
title: '%i18n:desktop.avatar-crop-title%',
|
title: '%i18n:desktop.avatar-crop-title%',
|
||||||
|
|
Loading…
Reference in a new issue