<commit_before>import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { Session } from 'meteor/session';
import { TAPi18n } from 'meteor/tap:i18n';
import { check } from 'meteor/check';

import { UserContext, User } from '/imports/api/users/User';
import { displayNotice } from '/imports/ui/modules/notice';
import { genesisTransaction, getVotes } from '/imports/api/transactions/transaction';
import { validateEmail } from './validations.js';

/**
* @summary makes sure username identifier meets criteria and is avaialble
* @param {string} username - picked username
*/
const _validateUsername = (username) => {
  const usernameValidationObject = {
    valid: false,
    repeated: false,
  };

  const regexp = /^[a-zA-Z0-9\-_]{0,40}$/;

  // Set whether username format is valid or not
  usernameValidationObject.valid = !regexp.test(username);

  // Only if username is valid, check whether it exists already
  if (regexp.test(username)) {
    Meteor.call('getUser', username, function (error, result) {
      if (result) {
        if (result.username !== Meteor.user().username) {
          Session.set('queryUsernameStatus', 'DUPLICATE');
        } else {
          Session.set('queryUsernameStatus', 'SINGULAR');
        }
        // instance.contract.set(result);
      } else if (error) {
        Session.set('queryUsernameStatus', 'SINGULAR');
      }
    });
  }
  return usernameValidationObject;
};

/**
* @summary password validation
* @param {string} pass - makes sure password meets criteria
*/
const _validatePassword = (pass) => {
  let val = true;
  if (pass.length < 6) {
    Session.set('invalidPassword', true);
    val = false;
  } else {
    Session.set('invalidPassword', false);<commit_msg>user verification while in anon mode fix<commit_after>import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { Session } from 'meteor/session';
import { TAPi18n } from 'meteor/tap:i18n';
import { check } from 'meteor/check';

import { UserContext, User } from '/imports/api/users/User';
import { displayNotice } from '/imports/ui/modules/notice';
import { genesisTransaction, getVotes } from '/imports/api/transactions/transaction';
import { validateEmail } from './validations.js';

/**
* @summary makes sure username identifier meets criteria and is avaialble
* @param {string} username - picked username
*/
const _validateUsername = (username) => {
  const usernameValidationObject = {
    valid: false,
    repeated: false,
  };

  const regexp = /^[a-zA-Z0-9\-_]{0,40}$/;

  // Set whether username format is valid or not
  usernameValidationObject.valid = !regexp.test(username);

  // Only if username is valid, check whether it exists already
  if (regexp.test(username)) {
    Meteor.call('getUser', username, function (error, result) {
      if (result) {
        if (Meteor.user()) {
          if (result.username !== Meteor.user().username) {
            Session.set('queryUsernameStatus', 'DUPLICATE');
          } else {
            Session.set('queryUsernameStatus', 'SINGULAR');
          }
        }
        // instance.contract.set(result);
      } else if (error) {
        Session.set('queryUsernameStatus', 'SINGULAR');
      }
    });
  }
  return usernameValidationObject;
};

/**
* @summary password validation
* @param {string} pass - makes sure password meets criteria
*/
const _validatePassword = (pass) => {
  let val = true;
  if (pass.length < 6) {
    Session.set('invalidPassword', true);
    val = false;
  } else {
    Session.set('invalidPassword', false);
{'fraction_non_alphanumeric': 0.14018952062430323, 'fraction_numerical': 0.005574136008918618, 'mean_word_length': 3.3982843137254903, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '1195547', 'n_tokens_mistral': 1096, 'n_tokens_neox': 1056, 'n_words': 281}