diff --git a/src/components/login/login.ts b/src/components/login/login.ts index 9b480f3..c18521b 100644 --- a/src/components/login/login.ts +++ b/src/components/login/login.ts @@ -2,6 +2,7 @@ import {Component, Prop, Vue} from 'vue-property-decorator'; import Constants from '@/constants'; import {HttpUtils} from '@/utils/http-utils'; import App from '@/components/app/app'; +import VersionUtils from '@/utils/version-utils'; /** * This component handles user login, and obtains data from the server. @@ -50,12 +51,8 @@ export default class Login extends Vue // Version doesn't exist if (!this.$cookies.isKey('va.version')) return true; - // Get version numbers - let current = Constants.VERSION.split('.'); - let cookies = this.$cookies.get('va.version').split('.'); - - // Check the commit number is even or odd - return +current[current.length - 1] % 2 != +cookies[cookies.length - 1] % 2; + // If the current version is greater than the min supported version + return VersionUtils.compare(Constants.MIN_SUPPORTED_VERSION, this.$cookies.get('va.version')) == -1; } /** diff --git a/src/utils/version-utils.ts b/src/utils/version-utils.ts index ee2ce5e..5d9dc39 100644 --- a/src/utils/version-utils.ts +++ b/src/utils/version-utils.ts @@ -6,7 +6,7 @@ export default class VersionUtils * Eg. * compare('0.1.2', '0.1.3') = -1 * compare('1.0.0', '0.1.3') = 1 - * compare('0.0.1', '0.0.1') = 0; + * compare('0.0.1', '0.0.1') = 0 * * @param ver1 Version 1 * @param ver2 Version 2