-dSignupForm = (Api, Auth, $location) ->
+dSignupForm = (Api, Auth, Notifications, $location) ->
 
   dSignupFormLink = ($scope, $element, $attrs) ->
     $scope.locked = false
     $scope.errors = []
+    note_id = null
 
     redirect = () ->
       $location.path('/dashboard')
 
     sucess = (user) ->
+      Notifications.remove note_id
       attempt = Auth.attempt $scope.credentials
       attempt.then redirect, redirect
       $scope.locked = false
+      note_id = false
 
     fail = (response) ->
+      Notifications.remove note_id
+      note_id = false
       errors = []
       data = response.data
 

      $scope.duplicate = false

    create = () ->
      $scope.locked = true

      params = angular.extend $scope.credentials,
        token: if $scope.token then $scope.token.token else false

    link: dSignupFormLink


dSignupForm.$inject = [
  'Api'
  'Auth'
  'Notifications'
  '$location'
]


lft.directive 'lfSignupForm', dSignupForm
