<commit_before>// The `@apostrophecms/user` module provides user accounts. It is **not** intended to
// be extended with new subclass modules. The `@apostrophecms/login` module only
// looks for instances of `@apostrophecms/user`. Of course you may implicitly subclass
// it at project level (not changing the name) in order to alter its behavior.
//
// ### Public "staff directories" vs. users
//
// In our experience, combining the concept of a "user" who can log in and do things
// with the concept of a "staff member" who appears in a staff directory is more
// trouble than it is worth.
//
// So for a staff directory, we suggest you create a separate `employee` module
// or similar, extending `@apostrophecms/piece-type`, unless it's true that basically
// everyone should be allowed to log in.
//
// ### `secrets` option
//
// For security the `password` property is not stored as plaintext and
// is not kept in the aposDocs collection. Instead, it is hashed and salted
// using the `credential` module and the resulting hash is stored
// in a separate `aposUsersSafe` collection.
//
// Additional secrets may be hashed in this way. If you set the
// `secrets` option to an array of property names, those properties
// are never stored directly to the database. Instead, only their
// hashes are stored, and only in `aposUsersSafe`.
//
// You may also call `apos.user.addSecret('name')` to add a new
// secret property. This is convenient when implementing a module
// such as `@apostrophecms/signup`.

const credential = require('credential');
const prompts = require('prompts');
const Promise = require('bluebird');

module.exports = {
  extend: '@apostrophecms/piece-type',
  options: {
    alias: 'user',
    name: '@apostrophecms/user',
    label: 'User',
    pluralLabel: 'Users',
    quickCreate: false,
    adminOnly: true,
    searchable: false,
    slugPrefix: 'user-',
    localized: false
  },
  fields(self) {
    return {
      add: {
        firstName: {
          type: 'string',
          label: '<NAME>'
        },
        lastName: {
          type: 'string',
          label: '<NAME>'
        },
        title: {
          type: 'string',
          label: '<NAME>',
          following: [ 'firstName', 'lastName' ],
          required: true
        },
        slug: {
          type: 'slug',
          label: 'Slug',
          following: 'title',
          required: true
        },
        disabled: {
          type: 'boolean',
          label: 'Login Disabled',
          def: false
        },
        username: {
          type: 'string',<commit_msg>Changes users title field to Display Name (#2909)<commit_after>// The `@apostrophecms/user` module provides user accounts. It is **not** intended to
// be extended with new subclass modules. The `@apostrophecms/login` module only
// looks for instances of `@apostrophecms/user`. Of course you may implicitly subclass
// it at project level (not changing the name) in order to alter its behavior.
//
// ### Public "staff directories" vs. users
//
// In our experience, combining the concept of a "user" who can log in and do things
// with the concept of a "staff member" who appears in a staff directory is more
// trouble than it is worth.
//
// So for a staff directory, we suggest you create a separate `employee` module
// or similar, extending `@apostrophecms/piece-type`, unless it's true that basically
// everyone should be allowed to log in.
//
// ### `secrets` option
//
// For security the `password` property is not stored as plaintext and
// is not kept in the aposDocs collection. Instead, it is hashed and salted
// using the `credential` module and the resulting hash is stored
// in a separate `aposUsersSafe` collection.
//
// Additional secrets may be hashed in this way. If you set the
// `secrets` option to an array of property names, those properties
// are never stored directly to the database. Instead, only their
// hashes are stored, and only in `aposUsersSafe`.
//
// You may also call `apos.user.addSecret('name')` to add a new
// secret property. This is convenient when implementing a module
// such as `@apostrophecms/signup`.

const credential = require('credential');
const prompts = require('prompts');
const Promise = require('bluebird');

module.exports = {
  extend: '@apostrophecms/piece-type',
  options: {
    alias: 'user',
    name: '@apostrophecms/user',
    label: 'User',
    pluralLabel: 'Users',
    quickCreate: false,
    adminOnly: true,
    searchable: false,
    slugPrefix: 'user-',
    localized: false
  },
  fields(self) {
    return {
      add: {
        firstName: {
          type: 'string',
          label: 'First Name'
        },
        lastName: {
          type: 'string',
          label: 'Last Name'
        },
        title: {
          type: 'string',
          label: 'Dislay Name',
          following: [ 'firstName', 'lastName' ],
          required: true
        },
        slug: {
          type: 'slug',
          label: 'Slug',
          following: 'title',
          required: true
        },
        disabled: {
          type: 'boolean',
          label: 'Login Disabled',
          def: false
        },
        username: {
          type: 'string',
{'fraction_non_alphanumeric': 0.11483895705521473, 'fraction_numerical': 0.0007668711656441718, 'mean_word_length': 2.5178691840863117, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '6943044', 'n_tokens_mistral': 1476, 'n_tokens_neox': 1440, 'n_words': 593}