Commit f5f8f11f authored by Randall Leeds's avatar Randall Leeds

Show form-wide auth failures inline

This is a step better than flash messages. It could be reworked to
inline above the submit button, or elsewhere, easily by changing the
template.
parent 3a97d56c
...@@ -624,12 +624,14 @@ class Auth ...@@ -624,12 +624,14 @@ class Auth
code: null code: null
_reset = -> _reset = ->
delete $scope.errors
angular.extend $scope.model, base angular.extend $scope.model, base
for own _, ctrl of $scope when typeof ctrl?.$setPristine is 'function' for own _, ctrl of $scope when typeof ctrl?.$setPristine is 'function'
ctrl.$setPristine() ctrl.$setPristine()
_error = (form, errors={}) -> _error = (form, data) ->
$scope.errors = {} {errors, reason} = data
$scope.errors = session: reason
$scope.errors[form] = {} $scope.errors[form] = {}
for field, error of errors for field, error of errors
$scope.errors[form][field] = error $scope.errors[form][field] = error
......
...@@ -89,8 +89,7 @@ class SessionProvider ...@@ -89,8 +89,7 @@ class SessionProvider
# Return the response or a rejected response. # Return the response or a rejected response.
if data.status is 'failure' if data.status is 'failure'
flash 'error', data.reason $q.reject(data)
$q.reject(data.errors)
else else
model model
......
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