<commit_before>'use strict';

const addClientSignUpDetails = require('../../db/redis.js').addClientSignUpDetails;
const clientSignUpSchema     = require('../utils/joiSchema.js').clientSignUpSchema;
const frontendInput          = require('../utils/joiSchema.js').frontendInput;
const cleanPayload           = require('../utils/app.js').cleanPayload;
const getName                = require('../utils/app.js').getName;
const url                    = require('../utils/joiSchema.js').url;


let opts = {
  url: url,
  frontendInput: frontendInput,
  title: 'Sign up'
};

exports.register = (server, options, next) => {

  server.route([{
    method: 'GET',
    path: '/clientsignup',
    config: {
      auth:{
          strategy: 'hrns-cookie'
      },
      handler: (request,reply) => {
        let name = getName(request.auth.credentials);
        if (name !== '') { opts.name = name; }
        reply.view('clientsignup', opts); // default layout should be fine
      }
    }
  }, {
      method: 'POST',
      path: '/clientsignup',
      config: {
        auth:{
            strategy: 'hrns-cookie'
        },
        validate: {
            payload: clientSignUpSchema
        },
        handler: (request,reply) => {
          let payload = cleanPayload(request.payload);
          let id      = request.auth.credentials.profile.id;
          let name    = getName(request.auth.credentials);

          if (name !== '') { opts.name = name; }

          addClientSignUpDetails(payload, id, (res) => {
            if (res) {
              opts.title = 'Success!';<commit_msg>adding suffix<commit_after>'use strict';

const addClientSignUpDetails = require('../../db/redis.js').addClientSignUpDetails;
const clientSignUpSchema     = require('../utils/joiSchema.js').clientSignUpSchema;
const frontendInput          = require('../utils/joiSchema.js').frontendInput;
const cleanPayload           = require('../utils/app.js').cleanPayload;
const getName                = require('../utils/app.js').getName;
const url                    = require('../utils/joiSchema.js').url;


let opts = {
  url: url,
  frontendInput: frontendInput,
  title: 'Sign up'
};

exports.register = (server, options, next) => {

  server.route([{
    method: 'GET',
    path: '/clientsignup',
    config: {
      auth:{
          strategy: 'hrns-cookie'
      },
      handler: (request,reply) => {
        let name = getName(request.auth.credentials);
        if (name !== '') { opts.name = name; }
        reply.view('clientsignup', opts); // default layout should be fine
      }
    }
  }, {
      method: 'POST',
      path: '/clientsignup',
      config: {
        auth:{
            strategy: 'hrns-cookie'
        }, 
        validate: {
            payload: clientSignUpSchema
        },
        handler: (request,reply) => {
          let payload = cleanPayload(request.payload);
          let id      = request.auth.credentials.profile.id +'clientId';
          let name    = getName(request.auth.credentials);

          if (name !== '') { opts.name = name; }

          addClientSignUpDetails(payload, id, (res) => {
            if (res) {
              opts.title = 'Success!';
{'fraction_non_alphanumeric': 0.15251026207767604, 'fraction_numerical': 0.0, 'mean_word_length': 2.099804305283757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2536276', 'n_tokens_mistral': 935, 'n_tokens_neox': 925, 'n_words': 183}