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

119
Vistas
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 Respuestas
Responde la pregunta

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 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