Browse Source

Fixed bug with users.update paramaters

theflametrooper 8 years ago
parent
commit
dfe67ee8dc

+ 2 - 2
backend/config/template.json

@@ -22,8 +22,8 @@
 	},
 	"cors": {
 		"origin": [
-			"http://localhost:8080",
-			"http://192.168.99.100:8080",
+			"http://localhost",
+			"http://192.168.99.100",
 			"http://dev.musare.com"
 		]
 	},

+ 1 - 3
backend/logic/actions/users.js

@@ -222,9 +222,7 @@ module.exports = {
                     if (err) cb({ status: 'error', message: err.message });
 					else cb({ status: 'success', message: 'Field saved successfully' });
                 });
-            } else {
-                cb({ status: 'error', message: 'Field has not changed' });
-            }
+            } else cb({ status: 'error', message: 'Field has not changed' });
         });
     })
 

+ 3 - 3
frontend/components/User/Settings.vue

@@ -83,7 +83,7 @@
 			changePassword: function () {
 				if (this.currentPassword == "" || this.newPassword == "") return Toast.methods.addToast('Current password field is incorrect', 2000);
 
-				this.socket.emit('users.update', 'services.password.password', this.user.password, res => {
+				this.socket.emit('users.update', this.user._id, 'services.password.password', this.user.password, res => {
 					if (res.status == 'error') Toast.methods.addToast(res.message, 2000);
 					else Toast.methods.addToast('Successfully changed password', 2000);
 				});
@@ -91,7 +91,7 @@
 			changeEmail: function () {
 				if (this.user.email == "") return Toast.methods.addToast('Field cannot be empty', 2000);
 
-				this.socket.emit('users.update', 'email.address', this.user.email, res => {
+				this.socket.emit('users.update', this.user._id, 'email.address', this.user.email, res => {
 					if (res.status == 'error') Toast.methods.addToast(res.message, 2000);
 					else Toast.methods.addToast('Successfully changed email address', 2000);
 				});
@@ -118,7 +118,7 @@
 			changeUsername: function () {
 				if (this.user.username == "") return Toast.methods.addToast('Field cannot be empty', 2000);
 
-				this.socket.emit('users.update', 'username', this.user.username, res => {
+				this.socket.emit('users.update', this.user._id, 'username', this.user.username, res => {
 					if (res.status == 'error') Toast.methods.addToast(res.message, 2000);
 					else Toast.methods.addToast('Successfully changed username', 2000);
 				});