summaryrefslogtreecommitdiffstats
path: root/webapp/src/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/src/main.js')
-rw-r--r--webapp/src/main.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/webapp/src/main.js b/webapp/src/main.js
index 6ed1d53..2665c0a 100644
--- a/webapp/src/main.js
+++ b/webapp/src/main.js
@@ -117,6 +117,16 @@ Vue.prototype.$loop = function (count, chunksize, iteration, callback = () => {}
return loop
}
+// Function for validating an email address.
+Vue.prototype.$validateEmail = email => {
+ // TODO: Remove if email is not optional
+ if (email === '') return true
+
+ // Removed escape before [ because eslint told me so.
+ var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
+ return re.test(String(email).toLowerCase())
+}
+
new Vue({
store,
router,