Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

265
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda