Commit 529b5f53 authored by Randall Leeds's avatar Randall Leeds

Small reset tweak in auth controller

It's clearer if the form clears itself through a reset rather than
waiting for it to happen later. This has the advantage of getting
the password out of reachable memory sooner.

Extending the scope rather than erasing its keys and replacing it
with the base scope means the Auth controller can clear the form
fields without clearing the session data in the scope.
parent 37acc1c6
......@@ -629,7 +629,7 @@ class Auth
code: null
_reset = ->
angular.copy base, $scope.model
angular.extend $scope.model, base
for own _, ctrl of $scope when typeof ctrl?.$setPristine is 'function'
ctrl.$setPristine()
......@@ -646,7 +646,7 @@ class Auth
return unless form.$valid
promise = session["$#{form.$name}"] ->
$scope.$emit 'success', form.$name
promise.then(angular.noop, _error)
promise.then(_reset, _error)
class Editor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment