diff --git a/src/const.js b/src/const.js index 850fa88..8ecace1 100644 --- a/src/const.js +++ b/src/const.js @@ -22,3 +22,5 @@ export const NOTIFY_CONFIG_RELOAD = 'configReload' export const NOTIFY_ERROR = 'error' export const NOTIFY_FETCH_ERROR = 'fetchError' export const NOTIFY_LOADING_DATA = 'loadingData' + +export const REGEXP_USER = /^[a-z0-9_]{4,25}$/ diff --git a/src/generalConfig.vue b/src/generalConfig.vue index c595aea..3877e66 100644 --- a/src/generalConfig.vue +++ b/src/generalConfig.vue @@ -56,11 +56,13 @@ this.$bus.$emit(constants.NOTIFY_FETCH_ERROR, err)) }, + + validateUserName(user) { + return user.match(constants.REGEXP_USER) + }, }, mounted() {