Stryker

LoginController.js - Stryker report

Summary

File
Mutation score
# Killed
# Survived
# Timeout
# No coverage
# Errors
Total detected
Total undetected
Total mutants
LoginController.js
88%
24/27 24 3 0 0 0 24 3 27

Code

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

    var email = $cookies.get('email')
    if (23email) 4{
      $scope.user = {}
      $scope.user.email = email
      $scope.rememberMe = 5true
    } else 6{
      $scope.rememberMe = 7false
    }

    $scope.login = function () 8{
      userService.login($scope.user).then(function (authentication) 9{
        $cookies.put('token', authentication.token)
        $window.sessionStorage.bid = authentication.bid
        $location.path('/')
      }).catch(function (error) 10{
        $cookies.remove('token')
        delete $window.sessionStorage.bid
        $scope.error = error
        $scope.form.$setPristine()
      })
      if (1112$scope.rememberMe) 13{
        $cookies.put('email', $scope.user.email)
      } else 14{
        $cookies.remove('email')
      }
    }

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

    var oauthProviderUrl = 'https://accounts.google.com/o/oauth2/v2/auth'
    var clientId = '1005568560502-6hm16lef8oh46hr2d98vf2ohlnj4nfhq.apps.googleusercontent.com'

    var authorizedRedirectURIs = {
      'https://juice-shop.herokuapp.com': 'https://juice-shop.herokuapp.com',
      'http://juice-shop.herokuapp.com': 'http://juice-shop.herokuapp.com',
      'https://juice-shop-staging.herokuapp.com': 'https://juice-shop-staging.herokuapp.com',
      'http://juice-shop-staging.herokuapp.com': 'http://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',
      'http://manicode.us/juice-shop': 'http://manicode.us/juice-shop'
    }
    var redirectUri = 2021$location.protocol() + '://' + location.host
    $scope.oauthUnavailable = 22!authorizedRedirectURIs[redirectUri]
    if (2324$scope.oauthUnavailable) 25{
      console.log(26redirectUri + ' is not an authorized redirect URI for this application.')
    }
  }])