Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

266
Vistas
Hello, how can i add another user login pass to my code?

I am trying to add another user and I am experimenting with this code showed all around the internet.

So I tried this example below, it works fine, but how could I add another user, let's say for a guest?

is it possible? with like a conditional?

I am just trying to learn more about js and how I can solve this type of simple thing.

   methods: {
        login() {
            if(this.input.username == "admin1" && this.input.password == "pass1") {
                this.$store.commit("setAuthentication", true);
                this.$router.replace({ name: "secure" });
            } else {
                console.log("The username and / or password is incorrect");
            }
        }
    }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You Can use Below Code:

 methods: {
        login() {
            if(this.input.username == "admin1" && this.input.password == "pass1") {
                this.$store.commit("setAuthentication", true);
                this.$router.replace({ name: "secure" });
            } else if (this.input.username == "guest" && this.input.password == "guest1") {
            //  block of code to be executed if the condition1 is false and condition2 is true
            }else {
                console.log("The username and / or password is incorrect");
            }
        }
    }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda