Quellcode durchsuchen

Added way to be returned to original page after GitHub login/register.

KrisVos130 vor 7 Jahren
Ursprung
Commit
afc8a89296

+ 4 - 0
frontend/App.vue

@@ -75,6 +75,10 @@
 		},
 		ready: function () {
 			let _this = this;
+			if (localStorage.getItem('github_redirect')) {
+			    this.$router.go(localStorage.getItem('github_redirect'));
+			    localStorage.removeItem('github_redirect');
+			}
 			auth.isBanned((banned) => {
 				console.log("BANNED: ", banned);
 				_this.banned = banned;

+ 4 - 1
frontend/components/Modals/Login.vue

@@ -20,7 +20,7 @@
 			</section>
 			<footer class='modal-card-foot'>
 				<a class='button is-primary' href='#' @click='submitModal("login")'>Submit</a>
-				<a class='button is-github' :href='$parent.serverDomain + "/auth/github/authorize"'>
+				<a class='button is-github' :href='$parent.serverDomain + "/auth/github/authorize"' @click="githubRedirect()">
 					<div class='icon'>
 						<img class='invert' src='/assets/social/github.svg'/>
 					</div>
@@ -46,6 +46,9 @@
 			resetPassword: function () {
 				this.toggleModal();
 				this.$router.go('/reset_password');
+			},
+			githubRedirect: function() {
+			    localStorage.setItem('github_redirect', this.$route.path)
 			}
 		},
 		events: {

+ 4 - 1
frontend/components/Modals/Register.vue

@@ -25,7 +25,7 @@
 			</section>
 			<footer class='modal-card-foot'>
 				<a class='button is-primary' href='#' @click='submitModal()'>Submit</a>
-				<a class='button is-github' :href='$parent.serverDomain + "/auth/github/authorize"'>
+				<a class='button is-github' :href='$parent.serverDomain + "/auth/github/authorize"' @click="githubRedirect()">
 					<div class='icon'>
 						<img class='invert' src='/assets/social/github.svg'/>
 					</div>
@@ -62,6 +62,9 @@
 			submitModal: function () {
 				this.$dispatch('register', this.recaptcha.id);
 				this.toggleModal();
+			},
+			githubRedirect: function() {
+				localStorage.setItem('github_redirect', this.$route.path)
 			}
 		},
 		events: {