mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-17 15:52:15 +00:00
frontend validation of team members limitation
This commit is contained in:
@@ -60,7 +60,7 @@
|
||||
"/chunks/plan-settings.js": "/chunks/plan-settings.js?id=c07a2a970dc5414a7d51",
|
||||
"/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=5151a942550b58d3ba69",
|
||||
"/chunks/plans.js": "/chunks/plans.js?id=0aa91553ed338315d39a",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=ddb79fb6130d8c6d85fe",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=e9399ef559a202138950",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=e64e3b67ccb89de9dd55",
|
||||
"/chunks/platform~chunks/shared~chunks/shared-with-me~chunks/team-folders.js": "/chunks/platform~chunks/shared~chunks/shared-with-me~chunks/team-folders.js?id=7d983dfdc91de607d737",
|
||||
"/chunks/profile.js": "/chunks/profile.js?id=8688d9c7ff850e6989e6",
|
||||
@@ -566,5 +566,77 @@
|
||||
"/chunks/platform.dfdf9807b5e5a42df629.hot-update.js": "/chunks/platform.dfdf9807b5e5a42df629.hot-update.js",
|
||||
"/chunks/platform.106a731410cf0cfa904f.hot-update.js": "/chunks/platform.106a731410cf0cfa904f.hot-update.js",
|
||||
"/chunks/platform.8317102f76e6a7ccb6dd.hot-update.js": "/chunks/platform.8317102f76e6a7ccb6dd.hot-update.js",
|
||||
"/chunks/platform.2ddb2dd6bf6a6992a1f4.hot-update.js": "/chunks/platform.2ddb2dd6bf6a6992a1f4.hot-update.js"
|
||||
"/chunks/platform.2ddb2dd6bf6a6992a1f4.hot-update.js": "/chunks/platform.2ddb2dd6bf6a6992a1f4.hot-update.js",
|
||||
"/chunks/platform.1903752550328919e23a.hot-update.js": "/chunks/platform.1903752550328919e23a.hot-update.js",
|
||||
"/chunks/platform.c7128ff4c32f2126f629.hot-update.js": "/chunks/platform.c7128ff4c32f2126f629.hot-update.js",
|
||||
"/chunks/platform.2df578c22f5243c88d23.hot-update.js": "/chunks/platform.2df578c22f5243c88d23.hot-update.js",
|
||||
"/chunks/platform.517d13a769a72d095db5.hot-update.js": "/chunks/platform.517d13a769a72d095db5.hot-update.js",
|
||||
"/chunks/platform.fab284872b1d2ffe62cb.hot-update.js": "/chunks/platform.fab284872b1d2ffe62cb.hot-update.js",
|
||||
"/chunks/files.995b8f0ceb27109567c3.hot-update.js": "/chunks/files.995b8f0ceb27109567c3.hot-update.js",
|
||||
"/chunks/platform.228209e20d2c1dac39ae.hot-update.js": "/chunks/platform.228209e20d2c1dac39ae.hot-update.js",
|
||||
"/chunks/platform.af23d47194fe248e7f29.hot-update.js": "/chunks/platform.af23d47194fe248e7f29.hot-update.js",
|
||||
"/chunks/platform.50b4d0a25cd2f56d2c7d.hot-update.js": "/chunks/platform.50b4d0a25cd2f56d2c7d.hot-update.js",
|
||||
"/chunks/platform.908a4dd3397583362adc.hot-update.js": "/chunks/platform.908a4dd3397583362adc.hot-update.js",
|
||||
"/chunks/platform.5514e7df7bf36fbf57c8.hot-update.js": "/chunks/platform.5514e7df7bf36fbf57c8.hot-update.js",
|
||||
"/chunks/platform.e86de1d4d509aa5ed231.hot-update.js": "/chunks/platform.e86de1d4d509aa5ed231.hot-update.js",
|
||||
"/chunks/platform.a6d2a7294f81275d758c.hot-update.js": "/chunks/platform.a6d2a7294f81275d758c.hot-update.js",
|
||||
"/chunks/platform.a2919eb9353748d7ca64.hot-update.js": "/chunks/platform.a2919eb9353748d7ca64.hot-update.js",
|
||||
"/chunks/platform.bdda26f0e92031239c37.hot-update.js": "/chunks/platform.bdda26f0e92031239c37.hot-update.js",
|
||||
"/chunks/platform.23997f4078e2a0703819.hot-update.js": "/chunks/platform.23997f4078e2a0703819.hot-update.js",
|
||||
"/chunks/platform.09cb33adcc622ae95859.hot-update.js": "/chunks/platform.09cb33adcc622ae95859.hot-update.js",
|
||||
"/chunks/platform.0aea1d900d5270483b38.hot-update.js": "/chunks/platform.0aea1d900d5270483b38.hot-update.js",
|
||||
"/chunks/platform.ee621cd6e20ac47764a2.hot-update.js": "/chunks/platform.ee621cd6e20ac47764a2.hot-update.js",
|
||||
"/chunks/platform.b4b92fba9bb3b5d9bf36.hot-update.js": "/chunks/platform.b4b92fba9bb3b5d9bf36.hot-update.js",
|
||||
"/chunks/platform.0debc5e14cc3664b91de.hot-update.js": "/chunks/platform.0debc5e14cc3664b91de.hot-update.js",
|
||||
"/chunks/platform.a081f951dacd0c2fe10b.hot-update.js": "/chunks/platform.a081f951dacd0c2fe10b.hot-update.js",
|
||||
"/chunks/platform.0fbfe25299823338420b.hot-update.js": "/chunks/platform.0fbfe25299823338420b.hot-update.js",
|
||||
"/chunks/platform.fb398d83770b93678156.hot-update.js": "/chunks/platform.fb398d83770b93678156.hot-update.js",
|
||||
"/chunks/platform.e1458283541570368def.hot-update.js": "/chunks/platform.e1458283541570368def.hot-update.js",
|
||||
"/chunks/platform.a1bc37f73b6ecf938827.hot-update.js": "/chunks/platform.a1bc37f73b6ecf938827.hot-update.js",
|
||||
"/chunks/platform.84d73cfbe25d0ec5143e.hot-update.js": "/chunks/platform.84d73cfbe25d0ec5143e.hot-update.js",
|
||||
"/chunks/platform.8cec006430c353c9b9d8.hot-update.js": "/chunks/platform.8cec006430c353c9b9d8.hot-update.js",
|
||||
"/chunks/platform.1af63eeb8d35f4a471ed.hot-update.js": "/chunks/platform.1af63eeb8d35f4a471ed.hot-update.js",
|
||||
"/chunks/platform.f2d736f73819e3c787a1.hot-update.js": "/chunks/platform.f2d736f73819e3c787a1.hot-update.js",
|
||||
"/chunks/platform.560ddb915e75e86c4273.hot-update.js": "/chunks/platform.560ddb915e75e86c4273.hot-update.js",
|
||||
"/chunks/platform.6d1a9d858772f5b268ba.hot-update.js": "/chunks/platform.6d1a9d858772f5b268ba.hot-update.js",
|
||||
"/chunks/platform.c1db90cf473022d512a5.hot-update.js": "/chunks/platform.c1db90cf473022d512a5.hot-update.js",
|
||||
"/chunks/platform.311fcafb71569d980019.hot-update.js": "/chunks/platform.311fcafb71569d980019.hot-update.js",
|
||||
"/chunks/platform.c4d5f26de5de03284ed6.hot-update.js": "/chunks/platform.c4d5f26de5de03284ed6.hot-update.js",
|
||||
"/chunks/platform.7a1649b73f7c26086d09.hot-update.js": "/chunks/platform.7a1649b73f7c26086d09.hot-update.js",
|
||||
"/chunks/platform.fa2cafd9c8fa95764ede.hot-update.js": "/chunks/platform.fa2cafd9c8fa95764ede.hot-update.js",
|
||||
"/chunks/platform.4e905e3268a59974a36a.hot-update.js": "/chunks/platform.4e905e3268a59974a36a.hot-update.js",
|
||||
"/chunks/platform.d96ef82afd6ffeda64a5.hot-update.js": "/chunks/platform.d96ef82afd6ffeda64a5.hot-update.js",
|
||||
"/chunks/platform.5814ccce087c550e5ad2.hot-update.js": "/chunks/platform.5814ccce087c550e5ad2.hot-update.js",
|
||||
"/chunks/platform.70ef81993aa85023218c.hot-update.js": "/chunks/platform.70ef81993aa85023218c.hot-update.js",
|
||||
"/chunks/platform.64bb980177ee1ae3a503.hot-update.js": "/chunks/platform.64bb980177ee1ae3a503.hot-update.js",
|
||||
"/chunks/platform.02af9eb22005e966b092.hot-update.js": "/chunks/platform.02af9eb22005e966b092.hot-update.js",
|
||||
"/chunks/platform.f34f3d0c663e28c6288d.hot-update.js": "/chunks/platform.f34f3d0c663e28c6288d.hot-update.js",
|
||||
"/chunks/platform.653179cb301aa9cba536.hot-update.js": "/chunks/platform.653179cb301aa9cba536.hot-update.js",
|
||||
"/chunks/platform.709e52847f013ff05f32.hot-update.js": "/chunks/platform.709e52847f013ff05f32.hot-update.js",
|
||||
"/chunks/platform.91c4cf223d16a292ebc2.hot-update.js": "/chunks/platform.91c4cf223d16a292ebc2.hot-update.js",
|
||||
"/chunks/platform.7f115d321fd41a508cc1.hot-update.js": "/chunks/platform.7f115d321fd41a508cc1.hot-update.js",
|
||||
"/chunks/platform.1a89bb86a8d4858fa3ec.hot-update.js": "/chunks/platform.1a89bb86a8d4858fa3ec.hot-update.js",
|
||||
"/js/main.e04185ce671eea914c48.hot-update.js": "/js/main.e04185ce671eea914c48.hot-update.js",
|
||||
"/js/main.dda58d9906694145fab9.hot-update.js": "/js/main.dda58d9906694145fab9.hot-update.js",
|
||||
"/chunks/platform.dda58d9906694145fab9.hot-update.js": "/chunks/platform.dda58d9906694145fab9.hot-update.js",
|
||||
"/js/main.fee07bb6f998c208b098.hot-update.js": "/js/main.fee07bb6f998c208b098.hot-update.js",
|
||||
"/js/main.8c4f87fa6c323b234525.hot-update.js": "/js/main.8c4f87fa6c323b234525.hot-update.js",
|
||||
"/js/main.0ec6491abd654eff9e33.hot-update.js": "/js/main.0ec6491abd654eff9e33.hot-update.js",
|
||||
"/js/main.8ff815333533818d57c7.hot-update.js": "/js/main.8ff815333533818d57c7.hot-update.js",
|
||||
"/js/main.2e1d5c3f09e30a2c54a5.hot-update.js": "/js/main.2e1d5c3f09e30a2c54a5.hot-update.js",
|
||||
"/js/main.cc913e64540a7bbccb48.hot-update.js": "/js/main.cc913e64540a7bbccb48.hot-update.js",
|
||||
"/js/main.7e2e57a47363acf25d05.hot-update.js": "/js/main.7e2e57a47363acf25d05.hot-update.js",
|
||||
"/js/main.18e85032d206ca88ca03.hot-update.js": "/js/main.18e85032d206ca88ca03.hot-update.js",
|
||||
"/js/main.e9d7b5951800c8c6c534.hot-update.js": "/js/main.e9d7b5951800c8c6c534.hot-update.js",
|
||||
"/chunks/platform.e9d7b5951800c8c6c534.hot-update.js": "/chunks/platform.e9d7b5951800c8c6c534.hot-update.js",
|
||||
"/js/main.50ac2408710d151969ca.hot-update.js": "/js/main.50ac2408710d151969ca.hot-update.js",
|
||||
"/chunks/platform.50ac2408710d151969ca.hot-update.js": "/chunks/platform.50ac2408710d151969ca.hot-update.js",
|
||||
"/js/main.c8310269a11dd067e978.hot-update.js": "/js/main.c8310269a11dd067e978.hot-update.js",
|
||||
"/js/main.878b771b19303e696e55.hot-update.js": "/js/main.878b771b19303e696e55.hot-update.js",
|
||||
"/chunks/platform.047295242463be21a753.hot-update.js": "/chunks/platform.047295242463be21a753.hot-update.js",
|
||||
"/js/main.24ef3d6765f7fa80be89.hot-update.js": "/js/main.24ef3d6765f7fa80be89.hot-update.js",
|
||||
"/chunks/platform.24ef3d6765f7fa80be89.hot-update.js": "/chunks/platform.24ef3d6765f7fa80be89.hot-update.js",
|
||||
"/chunks/platform.ac083f82e492812845de.hot-update.js": "/chunks/platform.ac083f82e492812845de.hot-update.js",
|
||||
"/chunks/platform.80d1bd8205a67c33a759.hot-update.js": "/chunks/platform.80d1bd8205a67c33a759.hot-update.js",
|
||||
"/chunks/files.ac15d61505883f75268c.hot-update.js": "/chunks/files.ac15d61505883f75268c.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -192,30 +192,23 @@
|
||||
})
|
||||
},
|
||||
addMember() {
|
||||
let email = this.email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)[0]
|
||||
|
||||
if (!email) {
|
||||
if (this.$isInvalidEmail(this.email)) {
|
||||
this.$refs.teamFolderForm.setErrors({
|
||||
'Email': this.$t("You have to type valid email")
|
||||
});
|
||||
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
// Get team folder limitations
|
||||
let limit = this.user.data.meta.limitations.max_team_members
|
||||
|
||||
if (limit.percentage >= 100 && ! limit.meta.allowed_emails.includes(email)) {
|
||||
if ( this.$cantInviteMember(this.email, this.invitations) ) {
|
||||
this.$refs.teamFolderForm.setErrors({
|
||||
'Email': this.$t("You have to upgrade your account to add this new member.")
|
||||
});
|
||||
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
this.$refs.teamFolderForm.reset()
|
||||
|
||||
this.invitations.push({
|
||||
this.invitations.unshift({
|
||||
type: 'invitation',
|
||||
email: this.email,
|
||||
permission: 'can-edit',
|
||||
@@ -250,6 +243,10 @@
|
||||
this.invitations = []
|
||||
}, 150)
|
||||
})
|
||||
|
||||
console.log(
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -153,28 +153,23 @@
|
||||
})
|
||||
},
|
||||
addMember() {
|
||||
let email = this.email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)[0]
|
||||
|
||||
if (!email) {
|
||||
if (this.$isInvalidEmail(this.email)) {
|
||||
this.$refs.teamFolderForm.setErrors({
|
||||
'Email': this.$t("You have to type valid email")
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Get team folder limitations
|
||||
let limit = this.user.data.meta.limitations.max_team_members
|
||||
|
||||
if (limit.percentage >= 100 && ! limit.meta.allowed_emails.includes(email)) {
|
||||
if ( this.$cantInviteMember(this.email, this.invitations) ) {
|
||||
this.$refs.teamFolderForm.setErrors({
|
||||
'Email': this.$t("You have to upgrade your account to add this new member.")
|
||||
});
|
||||
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
this.$refs.teamFolderForm.reset()
|
||||
|
||||
this.invitations.push({
|
||||
this.invitations.unshift({
|
||||
type: 'invitation',
|
||||
email: this.email,
|
||||
permission: 'can-edit',
|
||||
|
||||
27
resources/js/helpers/ValidatorHelpers.js
vendored
Normal file
27
resources/js/helpers/ValidatorHelpers.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import store from '../store/index'
|
||||
|
||||
const ValidatorHelpers = {
|
||||
install(Vue) {
|
||||
|
||||
Vue.prototype.$cantInviteMember = function (email, invitations) {
|
||||
// Get max team members limitations
|
||||
let limit = store.getters.user.data.meta.limitations.max_team_members
|
||||
|
||||
// Get emails from invitations and currently active members
|
||||
let newInvitationEmails = invitations.map(item => item['email'])
|
||||
let allowedMemberEmails = limit.meta.allowed_emails
|
||||
|
||||
// Get unique list of member emails
|
||||
let totalUniqueEmails = [...new Set(newInvitationEmails.concat(Object.values(allowedMemberEmails)))]
|
||||
|
||||
// If there is more unique emails than can be in limit, disable ability to add member
|
||||
return totalUniqueEmails.length >= limit.total && !totalUniqueEmails.includes(email);
|
||||
}
|
||||
|
||||
Vue.prototype.$isInvalidEmail = function (email) {
|
||||
return email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/) === null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ValidatorHelpers
|
||||
2
resources/js/main.js
vendored
2
resources/js/main.js
vendored
@@ -6,6 +6,7 @@ import router from "./router";
|
||||
import App from "./App.vue";
|
||||
import store from "./store";
|
||||
import {events} from "./bus";
|
||||
import ValidatorHelpers from "./helpers/ValidatorHelpers";
|
||||
import functionHelpers from "./helpers/functionHelpers";
|
||||
import itemHelpers from "./helpers/itemHelpers"
|
||||
import { library } from "@fortawesome/fontawesome-svg-core";
|
||||
@@ -86,6 +87,7 @@ library.add(
|
||||
Vue.component("FontAwesomeIcon", FontAwesomeIcon);
|
||||
|
||||
Vue.use(VueRouter);
|
||||
Vue.use(ValidatorHelpers);
|
||||
Vue.use(functionHelpers);
|
||||
Vue.use(itemHelpers);
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<template>
|
||||
<ContentSidebar>
|
||||
<!--Empty storage warning-->
|
||||
<ContentGroup v-if="user && config.storageLimit && storage.used > 95">
|
||||
<!-- <ContentGroup v-if="user && config.storageLimit && storage.used > 95">
|
||||
<UpgradeSidebarBanner/>
|
||||
</ContentGroup>
|
||||
</ContentGroup>-->
|
||||
|
||||
<!--Locations-->
|
||||
<ContentGroup :title="$t('sidebar.locations_title')">
|
||||
|
||||
Reference in New Issue
Block a user