Parameters adjustments + cosmetics
[vchess.git] / client / src / components / UpsertUser.vue
index 8d0b736..c8df869 100644 (file)
@@ -46,6 +46,20 @@ export default {
       enterTime: Number.MAX_SAFE_INTEGER, //for a basic anti-bot strategy
     };
   },
+       watch: {
+               nameOrEmail: function(newValue) {
+                       if (newValue.indexOf('@') >= 0)
+                       {
+                               this.user.email = newValue;
+                               this.user.name = "";
+                       }
+                       else
+                       {
+                               this.user.name = newValue;
+                               this.user.email = "";
+                       }
+               },
+       },
   computed: {
     submitMessage: function() {
       switch (this.stage)
@@ -149,6 +163,8 @@ export default {
           this.user.name = "";
           this.user.email = "";
           this.user.notify = false;
+          delete localStorage["myid"];
+          delete localStorage["myname"];
         }
       );
     },