<|start_filename|>webapp/src/components/CredentialsRecovery/index.js<|end_filename|>
export { default } from './CredentialsRecovery'


<|start_filename|>hapi/src/routes/verify-email/verify-email.route.js<|end_filename|>
const verifyEmailHandler = require('./verify-email.handler')
const verifyEmailValidation = require('./verify-email.validation')

module.exports = {
  method: 'POST',
  path: '/api/verify-email',
  handler: verifyEmailHandler,
  options: {
    validate: verifyEmailValidation,
    auth: false
  }
}


<|start_filename|>webapp/src/utils/on-img-error.js<|end_filename|>
export const onImgError = defaultLogo => ev => {
  if (ev.target.src === defaultLogo) {
    return
  }

  ev.target.src = defaultLogo
}


<|start_filename|>webapp/src/i18n.js<|end_filename|>
import i18n from 'i18next'
import LanguageDetector from 'i18next-browser-languagedetector'
import { initReactI18next } from 'react-i18next'
import resources from './language'

i18n
  .use(LanguageDetector)
  .use(initReactI18next)
  .init({
    load: 'unspecific',
    resources,
    fallbackNS: 'common',
    fallbackLng: 'en',
    interpolation: {
      escapeValue: false
    }
  })

export default i18n


<|start_filename|>webapp/src/routes/Route404/styles.js<|end_filename|>
export default theme => ({
  wrapper: {
    padding: theme.spacing(6),
    textAlign: 'center',
    background: 'transparent',
    [theme.breakpoints.up('md')]: {
      padding: theme.spacing(10)
    }
  }
})


<|start_filename|>webapp/src/utils/format-with-thousand-separator.js<|end_filename|>
export const formatWithThousandSeparator = (value, precision) => {
  if (!value || isNaN(value)) {
    return value
  }

  let newValue = parseFloat(value)

  if (precision >= 0) {
    newValue = newValue.toFixed(precision)
  }

  return newValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
}


<|start_filename|>webapp/src/components/RicardianContract/index.js<|end_filename|>
export { default } from './RicardianContract'


<|start_filename|>hapi/src/config/constants.js<|end_filename|>
module.exports = {
  ENUM_DATA: {
    LOCATION_TYPES: {
      SPONSOR: 'SPONSOR',
      LIFE_BANK: 'LIFE_BANK'
    }
  }
}


<|start_filename|>hapi/src/config/mail.config.js<|end_filename|>
module.exports = {
  host: process.env.HAPI_MAIL_HOST,
  port: process.env.HAPI_MAIL_PORT,
  user: process.env.HAPI_MAIL_USER,
  pass: <PASSWORD>.HAPI_MAIL_PASSWORD
}


<|start_filename|>hapi/src/routes/change-password/change-password.route.js<|end_filename|>
const changePasswordHandler = require('./change-password.handler')
const changePasswordValidation = require('./change-password.validation')

module.exports = {
  method: 'POST',
  path: '/api/change-password',
  handler: changePasswordHandler,
  options: {
    validate: changePasswordValidation,
    auth: false
  }
}


<|start_filename|>hapi/src/routes/check-username/check-username.route.js<|end_filename|>
const checkUsernameHandler = require('./check-username.handler')
const checkUsernameValidation = require('./check-username.validation')

module.exports = {
  method: 'POST',
  path: '/api/check-username',
  handler: checkUsernameHandler,
  options: {
    validate: checkUsernameValidation,
    auth: false
  }
}


<|start_filename|>hapi/src/routes/check-username/check-username.handler.js<|end_filename|>
const Boom = require('@hapi/boom')
const { BAD_REQUEST } = require('http-status-codes')

const { eosUtils } = require('../../utils')
const { userApi } = require('../../api')

module.exports = async ({ payload: { input } }) => {
  try {
    if (!/^[a-z12345.]{9}$/.test(input.username)) {
      return {
        is_valid: false
      }
    }

    const user = await userApi.getOne({
      username: { _eq: input.username }
    })

    if (user) {
      return {
        is_valid: false
      }
    }

    const account = await eosUtils.getAccount(
      `${input.role.substring(0, 3)}${input.username}`.substring(0, 12)
    )

    if (account) {
      return {
        is_valid: false
      }
    }

    return {
      is_valid: true
    }
  } catch (error) {
    console.error(error)
    return Boom.boomify(error, { statusCode: BAD_REQUEST })
  }
}


<|start_filename|>webapp/src/utils/eosapi.js<|end_filename|>
import EosApi from 'eosjs-api'

import { ualConfig } from '../config'

export const eosApi = EosApi({
  httpEndpoint: ualConfig.endpoint,
  verbose: false,
  fetchConfiguration: {}
})


<|start_filename|>hapi/src/routes/create-account/create-account.route.js<|end_filename|>
const createAccountHandler = require('./create-account.handler')
const createAccountValidation = require('./create-account.validation')

module.exports = {
  method: 'POST',
  path: '/api/accounts',
  handler: createAccountHandler,
  options: {
    validate: createAccountValidation,
    auth: false
  }
}


<|start_filename|>hapi/src/routes/login/login.route.js<|end_filename|>
const loginHandler = require('./login.handler')
const loginValidation = require('./login.validation')

module.exports = {
  method: 'POST',
  path: '/api/login',
  handler: loginHandler,
  options: {
    validate: loginValidation,
    auth: false
  }
}


<|start_filename|>hasura/Dockerfile<|end_filename|>
FROM hasura/graphql-engine:v1.3.3.cli-migrations-v2

ARG hasura_graphql_migrations_dir
ARG hasura_graphql_metadata_dir

ENV HASURA_GRAPHQL_MIGRATIONS_DIR $hasura_graphql_migrations_dir
ENV HASURA_GRAPHQL_METADATA_DIR $hasura_graphql_metadata_dir
ENV PORT 8080

EXPOSE $PORT

COPY migrations $HASURA_GRAPHQL_MIGRATIONS_DIR
COPY metadata $HASURA_GRAPHQL_METADATA_DIR

CMD graphql-engine \
  serve \
  --database-url $HASURA_GRAPHQL_DATABASE_URL

<|start_filename|>hapi/src/routes/credentials-recovery/credentials-recovery.route.js<|end_filename|>
const credentialsRecoveryHandler = require('./credentials-recovery.handler')
const credentialsRecoveryValidation = require('./credentials-recovery.validation')

module.exports = {
  method: 'POST',
  path: '/api/credentials-recovery',
  handler: credentialsRecoveryHandler,
  options: {
    validate: credentialsRecoveryValidation,
    auth: false
  }
}


<|start_filename|>hapi/src/routes/get-contract/get-contract.route.js<|end_filename|>
const getContractHandler = require('./get-contract.handler')
const getContractValidation = require('./get-contract.validation')

module.exports = {
  method: 'POST',
  path: '/api/get-contract',
  handler: getContractHandler,
  options: {
    validate: getContractValidation,
    auth: false
  }
}


<|start_filename|>hapi/src/utils/hasura.util.js<|end_filename|>
const { GraphQLClient } = require('graphql-request')
const { hasuraConfig } = require('../config')

module.exports = new GraphQLClient(hasuraConfig.url, {
  headers: {
    'x-hasura-admin-secret': hasuraConfig.adminSecret
  }
})
