Browse Source

Fixed issue with recaptcha loading twice.

KrisVos130 7 years ago
parent
commit
56d1937d96
2 changed files with 4 additions and 4 deletions
  1. 2 2
      frontend/App.vue
  2. 2 2
      frontend/components/Modals/Register.vue

+ 2 - 2
frontend/App.vue

@@ -84,10 +84,10 @@
 			}
 		},
 		events: {
-			'register': function () {
+			'register': function (recaptchaId) {
 				let { register: { email, username, password } } = this;
 				let _this = this;
-				this.socket.emit('users.register', username, email, password, grecaptcha.getResponse(), result => {
+				this.socket.emit('users.register', username, email, password, grecaptcha.getResponse(recaptchaId), result => {
 					if (result.status === 'success') {
 						Toast.methods.addToast(`You have successfully registered.`, 4000);
 						if (result.SID) {

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

@@ -49,7 +49,7 @@
 			let _this = this;
 			lofig.get('recaptcha', obj => {
 				_this.recaptcha.key = obj.key;
-				grecaptcha.render('recaptcha', {
+				_this.recaptcha.id = grecaptcha.render('recaptcha', {
 					'sitekey' : _this.recaptcha.key
 				});
 			});
@@ -60,7 +60,7 @@
 				else this.$dispatch('toggleModal', 'register');
 			},
 			submitModal: function () {
-				this.$dispatch('register');
+				this.$dispatch('register', this.recaptcha.id);
 				this.toggleModal();
 			}
 		},