mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 16:22:14 +00:00
frontend validation of team members limitation
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user