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

114
Visualizações
how can i put dummy email and password inside of node js code

when I try to log in I have an error message "No registered admin found". I know it's because of no existing admin info. now I want to insert a dummy email and password for the admin's login how can I put that? I'm new to this react and nodejs, please anyone can help me?

this is my code:

import { hash } from "../../../core/crypto/hash.js";
import { webToken } from "../../../core/crypto/web_token.js";
import { errors } from "../../../core/classes/errors.js";

import { adminsService } from "../../admins/index.js";

export const adminLogin = async (creds) => {

try {
   const admin = await adminsService.getWithCredentials(
    creds.email.toLowerCase()
   );

if (!admin) {
  throw new errors.Authentication("No registered admin found", "Auth");
}

if (!(await hash.verify(creds.password, admin.password))) {
  throw new errors.Authentication("Password doesn't match.", "Auth");
}

const token = webToken.generate({ uid: admin.id, role: "admin" }, "10h");

return { name: admin.name, email: admin.email, token };
 } catch (error) {
  throw error;
  }
 };

this is the problem:

authentication No registered admin found
Authentication {
   type: 'authentication',
   message: 'No registered admin found',
   from: 'Auth'
 }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you probably want to use an environment variable, and you dont want to commit the file that contains the environment variable. The same pattern you would use for secrets, API keys, etc.

IE make new file: develop.env contains:

ADMIN_USERNAME={yourusername}
ADMIN_PASS={yourpass}

then add develop.env to .gitignore so its never committed and nobody sees your details. This file will exist on the server in a production environment, for now it can rest on your local machine.

Note: this can be done with regular JS objects too. .env is just how the dotenv package in js works. https://github.com/motdotla/dotenv

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