message: Extractand reuse function to retrieve CAPTCHA
diff: @@ -12,25 +12,25 @@ angular.module('juiceShop').controller('ContactController', [
  $scope.userEmail = data.email || 'anonymous'
  })
  + function getNewCaptcha () {
  captchaService.getCaptcha().then(function (data) {
  $scope.captcha = data.captcha
  $scope.captchaId = data.captchaId
  })
  + }
  + getNewCaptcha()
  $scope.save = function () {
  $scope.feedback.captchaId = $scope.captchaId
  feedbackService.save($scope.feedback).then(function (savedFeedback) {
  $scope.error = null
  $scope.confirmation = 'Thank you for your feedback' + (savedFeedback.rating === 5 ? ' and your 5-star rating!' : '.')
  - captchaService.getCaptcha().then(function (data) {
  - $scope.captcha = data.captcha
  - $scope.captchaId = data.captchaId
  - })
  $scope.feedback = {}
  + getNewCaptcha()
  $scope.form.$setPristine()
  }).catch(function (error) {
  - $scope.confirmation = null
  $scope.error = error
  + $scope.confirmation = null
  $scope.feedback = {}
  $scope.form.$setPristine()
  })
  