<commit_before>class LoginAppsController extends AppController

  handler = (callback)->-> KD.singleton('appManager').open 'Login', callback

  handleResetRoute = ({params:{token}})->
    do handler (app)=>
      if KD.isLoggedIn()
        KD.getSingleton('router').handleRoute "/Account/Profile?focus=password&token=#{token}"
      else
        app.getView().setCustomDataToForm('reset', {recoveryToken:token})
        app.getView().animateToForm('reset')

  KD.registerAppClass this,
    name                        : "Login"
    routes                      :
      '/:name?/Login'           : handler (app)-> app.getView().animateToForm 'login'
      '/:name?/Redeem'          : handler (app)-> app.getView().animateToForm 'redeem'
      '/:name?/Register'        : handler (app)-> app.getView().animateToForm 'register'
      '/:name?/Recover'         : handler (app)-> app.getView().animateToForm 'recover'
      '/:name?/Reset/:token'    : handleResetRoute
      '/:name?/ResendToken'     : handler (app)-> app.getView().animateToForm 'resendEmail'
    hiddenHandle                : yes
    behavior                    : 'application'
    preCondition                :
      condition             : (options, cb)->
        # return cb yes if KD.singleton('router').getCurrentPath() is '/Reset'
        cb not KD.isLoggedIn()
      failure               : -> KD.getSingleton('router').handleRoute "/Activity"

  constructor:(options = {}, data)->

    options.view    = new LoginView
      testPath      : "landing-login"
    options.appInfo =
      name          : "Login"

    super options, data<commit_msg>Client:Login: removed precondition from app registiration<commit_after>class LoginAppsController extends AppController

  handler = (callback)->->
    unless KD.isLoggedIn()
      KD.singleton('appManager').open 'Login', callback
    else
      KD.getSingleton('router').handleRoute "/Activity"

  handleResetRoute = ({params:{token}})->
    KD.singleton('appManager').open 'Login', (app)=>
      if KD.isLoggedIn()
        KD.getSingleton('router').handleRoute "/Account/Profile?focus=password&token=#{token}"
      else
        app.getView().setCustomDataToForm('reset', {recoveryToken:token})
        app.getView().animateToForm('reset')

  KD.registerAppClass this,
    name                        : "Login"
    routes                      :
      '/:name?/Login'           : handler (app)-> app.getView().animateToForm 'login'
      '/:name?/Redeem'          : handler (app)-> app.getView().animateToForm 'redeem'
      '/:name?/Register'        : handler (app)-> app.getView().animateToForm 'register'
      '/:name?/Recover'         : handler (app)-> app.getView().animateToForm 'recover'
      '/:name?/Reset'           : handler (app)-> app.getView().animateToForm 'reset'
      '/:name?/Reset/:token'    : handleResetRoute
      '/:name?/ResendToken'     : handler (app)-> app.getView().animateToForm 'resendEmail'
    hiddenHandle                : yes
    behavior                    : 'application'
    # removed preCondition because Reset can be called while
    # current user logged-in status
  constructor:(options = {}, data)->

    options.view    = new LoginView
      testPath      : "landing-login"
    options.appInfo =
      name          : "Login"

    super options, data
{'fraction_non_alphanumeric': 0.14285714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 2.338709677419355, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, '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': '2127006', 'n_tokens_mistral': 967, 'n_tokens_neox': 919, 'n_words': 185}