<commit_before>'use strict'

angular
  .module('hubGourmetApp')
  .service('authService', authService)

function authService ($log, lock, authManager, localStorageService) {
  function login () {
    lock.show()
  }

  // Set up the logic for when a user authenticates
  // This method is called from app.run.js
  function registerAuthenticationListener () {
    lock.on('authenticated', function (authResult) {
      localStorageService.set('id_token', authResult.idToken)
      authManager.authenticate()
    })

    lock.on('authorization_error', function (err) {
      $log.error(err)
    })
  }

  return {
    login: login,
    registerAuthenticationListener: registerAuthenticationListener,
    logout: logout
  }

  function logout () {
    localStorageService.remove('id_token')
    authManager.unauthenticate()
  }
}<commit_msg>Redirect to login view after logout<commit_after>'use strict'

angular
  .module('hubGourmetApp')
  .service('authService', authService)

function authService ($log, lock, authManager, localStorageService, $location) {
  function login () {
    lock.show()
  }

  // Set up the logic for when a user authenticates
  // This method is called from app.run.js
  function registerAuthenticationListener () {
    lock.on('authenticated', function (authResult) {
      localStorageService.set('id_token', authResult.idToken)
      authManager.authenticate()
    })

    lock.on('authorization_error', function (err) {
      $log.error(err)
    })
  }

  return {
    login: login,
    registerAuthenticationListener: registerAuthenticationListener,
    logout: logout
  }

  function logout () {
    localStorageService.remove('id_token')
    authManager.unauthenticate()
    $location.url('/login')
  }
}
{'fraction_non_alphanumeric': 0.11341393206678181, 'fraction_numerical': 0.0, 'mean_word_length': 3.748633879781421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5741013', 'n_tokens_mistral': 515, 'n_tokens_neox': 499, 'n_words': 113}