<commit_before>#### $scope.User
# > Implements the Parse API `User` Object Type
class $scope.User extends $scope.Object
  #### defaults
  # > default user values for login
  defaults:
    username:null
    password:<PASSWORD>
    email:null
  #### __action
  # > holds the action type
  __action:'operate'
  #### urlMap
  # > Map of routes addressed `__action` type
  urlMap:
    create:"#{$scope.API_URI}/users"
    login:"#{$scope.API_URI}/login"
    passwordReset:"#{$scope.API_URI}/requestPasswordReset"
    operate:"#{$scope.API_URI}/users"
  #### url()
  # > Overrides `$scope.Object.url`
  url:->
    @urlMap[@__action] + ( if @__action == 'operate' and !@isNew() then "/#{@get 'objectId'}" else '')
  #### signUp(attrs,[options])
  # > Provides Parse API User.signUp feature
  signUp:(attrs, options)->
    # calls save to invoke `__action` type 'create'
    @save attrs || null, options
  #### logIn()
  # > Provides Parse API User.logIn feature
  logIn:(username, password, options)->
    # sets `__action` type to 'login'
    @__action = 'login'
    # sets `urlMap` address 'login' to parameterized query string
    @urlMap['login'] = encodeURI @urlMap['login'].replace /\/login+.*/, "/login?username=#{username}&password=#{password}"
    # initializes `opts` with success callback
    (opts = {}).success = (m,r,o)=>
      # sets `$scope.SESSION_TOKEN`
      $scope.SESSION_TOKEN = @get 'sessionToken'
      # deletes `sessionToken` from attributes
      delete @attributes.sessionToken
      # invokes user defined success callback if exists
      options.success m,r,o if options.success
    # calls `fetch`
    @fetch _.extend _.clone(options), opts
  #### logout()
  # > Provides non-supported logout feature as a convenience
  logOut:->
    # resets `$scope.SESSION_TOKEN`
    $scope.SESSION_TOKEN = undefined
    # resets `urlMap` address 'login' to default
    @urlMap['login'] = @urlMap['login'].replace /\/login+.*/, '/login'
    # resets id
    @id = null
    # resets `attributes` to `defaults`
    @set @defaults
  #### resetPassword([options])
  # > Provides Parse API resetPassword feature
  resetPassword:(options)->
    # returns false if email is empty
    return false if (email = @get 'email') == null
    # sets `__action` to type 'passwordReset'<commit_msg>updated User login<commit_after>#### $scope.User
# > Implements the Parse API `User` Object Type
class $scope.User extends $scope.Object
  #### defaults
  # > default user values for login
  defaults:
    username:null
    password:<PASSWORD>
    email:null
  #### __action
  # > holds the action type
  __action:'operate'
  #### urlMap
  # > Map of routes addressed `__action` type
  urlMap:
    create:"#{$scope.API_URI}/users"
    login:"#{$scope.API_URI}/login"
    passwordReset:"#{$scope.API_URI}/requestPasswordReset"
    operate:"#{$scope.API_URI}/users"
  #### url()
  # > Overrides `$scope.Object.url`
  url:->
    @urlMap[@__action] + ( if @__action == 'operate' and !@isNew() then "/#{@get 'objectId'}" else '')
  #### signUp(attrs,[options])
  # > Provides Parse API User.signUp feature
  signUp:(attrs, options)->
    # calls save to invoke `__action` type 'create'
    @save attrs || null, options
  #### logIn()
  # > Provides Parse API User.logIn feature
  logIn:(username, password, options)->
    # sets `__action` type to 'login'
    @__action = 'login'
    # sets `urlMap` address 'login' to parameterized query string
    # @urlMap['login'] = encodeURI @urlMap['login'].replace /\/login+.*/, "/login?username=#{username}&password=#{password}"
    # initializes `opts` with success callback
    (opts = {}).success = (m,r,o)=>
      # sets `$scope.SESSION_TOKEN`
      $scope.SESSION_TOKEN = @get 'sessionToken'
      # deletes `sessionToken` from attributes
      delete @attributes.sessionToken
      # invokes user defined success callback if exists
      options.success m,r,o if options.success
    # calls `fetch`
    @save {username:username, password:password}, _.extend _.clone(options), opts
  #### restore(token)
  #> restores login session from stored sessionToken
  restore:(token,options={})->
    @urlMap['login'] = encodeURI "#{@urlMap['login']}/#{token}"
    # initializes `opts` with success callback
    (opts = {}).success = (m,r,o)=>
      # sets `$scope.SESSION_TOKEN`
      $scope.SESSION_TOKEN = @get 'sessionToken'
      # deletes `sessionToken` from attributes
      delete @attributes.sessionToken
      # invokes user defined success callback if exists
      options.success?.apply @, arguments
    # calls `fetch`
    @fetch _.extend _.clone(options), opts
  #### logout()
  # > Provides non-supported logout feature as a convenience
  logOut:(options={})->
    opts = success = =>
      # resets `$scope.SESSION_TOKEN`
      $scope.SESSION_TOKEN = undefined
      # resets id
      @id = null
      # resets `attributes` to `defaults`
      @set @defaults
      options.success?.apply @, arguments
    @destroy
  #### resetPassword([options])
  # > Provides Parse API resetPassword feature
  resetPassword:(options)->
    # returns false if email is empty
    return false if (email = @get 'email') == null
    # sets `__action` to type 'passwordReset'
{'fraction_non_alphanumeric': 0.1494319275948392, 'fraction_numerical': 0.0, 'mean_word_length': 3.5601404741000877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '5736092', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1575, 'n_words': 437}