Stryker

ForgotPasswordController.js - Stryker report

Summary

File
Mutation score
# Killed
# Survived
# Timeout
# No coverage
# Errors
Total detected
Total undetected
Total mutants
ForgotPasswordController.js
100%
11/11 11 0 0 0 0 11 0 11

Code

angular.module('juiceShop').controller('ForgotPasswordController', 0[
  '$scope',
  '$location',
  'UserService',
  'SecurityQuestionService',
  function ($scope, $location, userService, securityQuestionService) 1{
    'use strict'

    $scope.findSecurityQuestion = function () 2{
      $scope.securityQuestion = undefined
      if (34$scope.email) 5{
        securityQuestionService.findBy($scope.email).then(function (securityQuestion) 6{
          $scope.securityQuestion = securityQuestion.question
        })
      }
    }

    $scope.resetPassword = function () 7{
      userService.resetPassword({email: $scope.email, answer: $scope.securityAnswer, new: $scope.newPassword, repeat: $scope.newPasswordRepeat}).then(function () 8{
        $scope.error = undefined
        $scope.confirmation = 'Your password was successfully changed.'
        resetForm()
      }).catch(function (error) 9{
        $scope.error = error
        $scope.confirmation = undefined
        resetForm()
      })
    }

    function resetForm () 10{
      $scope.email = undefined
      $scope.securityQuestion = undefined
      $scope.securityAnswer = undefined
      $scope.newPassword = undefined
      $scope.newPasswordRepeat = undefined
      $scope.form.$setPristine()
    }
  }])