server/src/Entity/authentication.js
/**
    * Method to check the validity of the login.
    * @returns {Promise<Array>}: the details of the user after successful login.
    */
Method to check the validity of the login.
@returns {Promise}: the details of the user after successful login.
Method to check the validity of the login . @returns { Promise } : the details of the user after successful login .
checkValidity() {
      return new Promise((resolve, reject) => {
         database.runSp(constants.SP_LOGIN, [this._emailId, this._password])
            .then(_resultSet => {
               const result = _resultSet[0][0];
               const authObj = {};
               if (result.id > 0) {
                  authObj[constants.JW_TOKEN] = tokenGenerator.getToken(generator.generateParsedJSON(result));
               }
               authObj[constants.USER_DATA] = result;
               resolve(authObj);
            }).catch(err => {
            printer.printError(err);
            reject(err);
         });
      });
   }
checkValidity ( ) { return new Promise ( ( resolve , reject ) => { database . runSp ( constants . SP_LOGIN , [ this . _emailId , this . _password ] ) . then ( _resultSet => { const result = _resultSet [ 0 ] [ 0 ] ; const authObj = { } ; if ( result . id > 0 ) { authObj [ constants . JW_TOKEN ] = tokenGenerator . getToken ( generator . generateParsedJSON ( result ) ) ; } authObj [ constants . USER_DATA ] = result ; resolve ( authObj ) ; } ) . catch ( err => { printer . printError ( err ) ; reject ( err ) ; } ) ; } ) ; }
Method to check the validity of the login.
Method to check the validity of the login .