webserver/controllers/create-account-controller.js
/**
 * Creates a verification code and stores this into the db.
 * @param {string} userId User's id
 * @returns The created code or null in case of error.
 */
Creates a verification code and stores this into the db.
@param {string} userId User's id
@returns The created code or null in case of error.
Creates a verification code and stores this into the db . @param { string } userId User ' s id @returns The created code or null in case of error .
async function addVerificationCode(uuid) {
  const verificationCode = uuidV4();
  const now = new Date();
  const createdAt = now
    .toISOString()
    .substring(0, 19)
    .replace("T", " ");
  const userActivation = new UserActivation({
    uuid,
    verificationCode,
    createdAt
  });
  try {
    await userActivation.save();
    return verificationCode;
  } catch (e) {
    console.error(e);
    return null;
  }
}
async function addVerificationCode ( uuid ) { const verificationCode = uuidV4 ( ) ; const now = new Date ( ) ; const createdAt = now . toISOString ( ) . substring ( 0 , 19 ) . replace ( "T" , " " ) ; const userActivation = new UserActivation ( { uuid , verificationCode , createdAt } ) ; try { await userActivation . save ( ) ; return verificationCode ; } catch ( e ) { console . error ( e ) ; return null ; } }
Creates a verification code and stores this into the db.
Creates a verification code and stores this into the db .