Browse Source

Fixed issues with login and register routes

theflametrooper 8 years ago
parent
commit
0ff1856c20

+ 1 - 1
frontend/build/index.html

@@ -44,7 +44,7 @@
 	<script type='text/javascript' src='https://cdn.rawgit.com/atjonathan/lofig/master/dist/lofig.min.js'></script>
 </head>
 <body>
-	<script src='/bundle.js'></script>
 	<script src='https://www.google.com/recaptcha/api.js'></script>
+	<script src='/bundle.js'></script>
 </body>
 </html>

+ 2 - 5
frontend/components/Modals/Login.vue

@@ -36,11 +36,8 @@
 	export default {
 		methods: {
 			toggleModal: function () {
-				if (this.$router._currentRoute.path === '/login') {
-					location.href = '/';
-				} else {
-					this.$dispatch('toggleModal', 'login');
-				}
+				if (this.$router._currentRoute.path === '/login') location.href = '/';
+				else this.$dispatch('toggleModal', 'login');
 			},
 			submitModal: function () {
 				this.$dispatch('login');

+ 3 - 2
frontend/components/Modals/Register.vue

@@ -47,7 +47,7 @@
 		},
 		ready: function () {
 			let _this = this;
-			lofig.get('recaptcha', function (obj) {
+			lofig.get('recaptcha', obj => {
 				_this.recaptcha.key = obj.key;
 				grecaptcha.render('recaptcha', {
 					'sitekey' : _this.recaptcha.key
@@ -56,7 +56,8 @@
 		},
 		methods: {
 			toggleModal: function () {
-				this.$dispatch('toggleModal', 'register');
+				if (this.$router._currentRoute.path === '/register') location.href = '/';
+				else this.$dispatch('toggleModal', 'register');
 			},
 			submitModal: function () {
 				this.$dispatch('register');

+ 0 - 1
frontend/components/Station/Station.vue

@@ -428,7 +428,6 @@
 					if (res.status === 'error') {
 						_this.$router.go('/404');
 						Toast.methods.addToast(res.message, 3000);
-						console.log('yup')
 					}
 				});
 

+ 4 - 0
frontend/main.js

@@ -17,6 +17,7 @@ import User from './components/User/Show.vue';
 import Settings from './components/User/Settings.vue';
 import ResetPassword from './components/User/ResetPassword.vue';
 import Login from './components/Modals/Login.vue';
+import Register from './components/Modals/Register.vue';
 
 Vue.use(VueRouter);
 
@@ -97,6 +98,9 @@ router.map({
 	'/login': {
 		component: Login
 	},
+	'/register': {
+		component: Register
+	},
 	'/admin': {
 		component: Admin,
 		adminRequired: true