<commit_before>class LoginController
  constructor: ($routeParams, $window, AuthenticatorService) ->
    @routeParams = $routeParams
    @window = $window
    @AuthenticatorService = AuthenticatorService

  emailRequiredError: =>
    return true if @loginForm.email.$error.required && @loginForm.email.$touched
    return true if @loginForm.$submitted

  passwordRequiredError: =>
    return true if @loginForm.password.$error.required && @loginForm.password.$touched
    return true if @loginForm.$submitted

  login: (email, password) =>
    @loginForm.email.$setTouched()
    @loginForm.password.$setTouched()
    return unless @loginForm.$valid

    callbackUrl = @routeParams.callback ? 'https://app.octoblu.com/api/session'

    @loading = true
    @AuthenticatorService
      .authenticate email, password, callbackUrl
      .then (location) =>
        @window.location = location
      .catch (error) =>
        @loading = false
        @errorMessage = error

angular.module('email-password').controller 'LoginController', LoginController
<commit_msg>done.<commit_after>class LoginController
  constructor: ($routeParams, $window, AuthenticatorService) ->
    @routeParams = $routeParams
    @window = $window
    @AuthenticatorService = AuthenticatorService

  emailRequiredError: =>
    return true if @loginForm.email.$error.required && @loginForm.email.$touched
    return true if @loginForm.$submitted && !@loginForm.email

  passwordRequiredError: =>
    return true if @loginForm.password.$error.required && @loginForm.password.$touched
    return true if @loginForm.$submitted

  login: (email, password) =>
    @loginForm.email.$setTouched()
    @loginForm.password.$setTouched()
    return unless @loginForm.$valid

    callbackUrl = @routeParams.callback ? 'https://app.octoblu.com/api/session'

    @loading = true
    @AuthenticatorService
      .authenticate email, password, callbackUrl
      .then (location) =>
        @window.location = location
      .catch (error) =>
        @loading = false
        @errorMessage = error

angular.module('email-password').controller 'LoginController', LoginController

{'fraction_non_alphanumeric': 0.11637728765837635, 'fraction_numerical': 0.0, 'mean_word_length': 3.791011235955056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '3486568', 'n_tokens_mistral': 600, 'n_tokens_neox': 579, 'n_words': 127}