angular.module('juiceShop').controller('LoginController', [
  '$scope',
  '$window',
  '$location',
  '$cookies',
  'UserService',
  function ($scope, $window, $location, $cookies, userService) {
    'use strict'

    var email = $cookies.get('email')
    if (email) {
      $scope.user = {}
      $scope.user.email = email
      $scope.rememberMe = true
    } else {
      $scope.rememberMe = false
    }

    $scope.login = function () {
      userService.login($scope.user).success(function (authentication) {
        $cookies.put('token', authentication.token)
        $window.sessionStorage.bid = authentication.bid
        $location.path('/')
      }).error(function (error) {
        $cookies.remove('token')
        delete $window.sessionStorage.bid
        $scope.error = error
        $scope.form.$setPristine()
      })
      if ($scope.rememberMe) {
        $cookies.put('email', $scope.user.email)
      } else {
        $cookies.remove('email')
      }
    }

    $scope.googleLogin = function () {
      $window.location.replace(oauthProviderUrl + '?client_id=' + clientId + '&response_type=token&scope=email&redirect_uri=' + authorizedRedirectURIs[redirectUri])
    }

    var oauthProviderUrl = 'https://accounts.google.com/o/oauth2/v2/auth'
    var clientId = '574734844546-3hgu54ot1vf09d7jemgve8avncn4q3ka.apps.googleusercontent.com'

    var authorizedRedirectURIs = {
      'https://quiet-lake-65056.herokuapp.com': 'https://quiet-lake-65056.herokuapp.com',
      'https://juice-shop.herokuapp.com': 'https://juice-shop.herokuapp.com',
      'https://juice-shop-staging.herokuapp.com': 'https://juice-shop-staging.herokuapp.com',
      'http://localhost:3000': 'http://localhost:3000',
      'http://juice.sh': 'http://juice.sh',
      'http://192.168.99.100:3000': 'http://tinyurl.com/ipMacLocalhost'
    }
    var redirectUri = $location.protocol() + '://' + location.host
    $scope.oauthUnavailable = !authorizedRedirectURIs[redirectUri]
    if ($scope.oauthUnavailable) {
      console.log(redirectUri + ' is not an authorized redirect URI for this application.')
    }
  }])

@@ -1276,53 +1276,54 @@
  = '
-574734844546-3hgu54ot1vf09d7jemgve8avncn4q3ka
+1005568560502-6hm16lef8oh46hr2d98vf2ohlnj4nfhq
 .app
@@ -1387,98 +1387,8 @@
 = %7B%0A
-      'https://quiet-lake-65056.herokuapp.com': 'https://quiet-lake-65056.herokuapp.com',%0A
     

Revert "adding url to oauth so it works right."