<commit_before>#= require ./user

class CurrentUserPassword extends Backbone.Model
  defaults:
    current_password: ''
    password: ''
    password_confirmation: ''

  url: -> '/api/beta/current_user/password'
  isNew: -> false

  # Weirdly, this is not default behaviour
  clear: ->
    @set @defaults

  validate: (attributes, options) ->
    errors = _.compact [
      if attributes.current_password.length == 0
        current_password: '*'

      if attributes.password.length == 0
        password: '*'
      else if attributes.password.length < 6 # seems to be enforced by Devis
        password: '<PASSWORD>'

      if attributes.password_confirmation.length == 0
        password_confirmation: '*'
      else if attributes.password_confirmation != attributes.password
        password_confirmation: 'does not match'
    ]

    console.info errors

    errors.length && _.extend({}, errors...)


class window.CurrentUser extends User<commit_msg>Removed console.info<commit_after>#= require ./user

class CurrentUserPassword extends Backbone.Model
  defaults:
    current_password: ''
    password: ''
    password_confirmation: ''

  url: -> '/api/beta/current_user/password'
  isNew: -> false

  # Weirdly, this is not default behaviour
  clear: ->
    @set @defaults

  validate: (attributes, options) ->
    errors = _.compact [
      if attributes.current_password.length == 0
        current_password: '*'

      if attributes.password.length == 0
        password: '*'
      else if attributes.password.length < 6 # seems to be enforced by Devis
        password: '<PASSWORD>'

      if attributes.password_confirmation.length == 0
        password_confirmation: '*'
      else if attributes.password_confirmation != attributes.password
        password_confirmation: 'does not match'
    ]

    errors.length && _.extend({}, errors...)


class window.CurrentUser extends User
{'fraction_non_alphanumeric': 0.10676532769556026, 'fraction_numerical': 0.004228329809725159, 'mean_word_length': 2.9355509355509355, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '664557', 'n_tokens_mistral': 536, 'n_tokens_neox': 502, 'n_words': 138}