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
code: null
_reset = ->
delete $scope.errors
angular.extend $scope.model, base
for own _, ctrl of $scope when typeof ctrl?.$setPristine is 'function'
ctrl.$setPristine()
_error = (form, errors={}) ->
$scope.errors = {}
_error = (form, data) ->
{errors, reason} = data
$scope.errors = session: reason
$scope.errors[form] = {}
for field, error of errors
$scope.errors[form][field] = error
......
......@@ -89,8 +89,7 @@ class SessionProvider
# Return the response or a rejected response.
if data.status is 'failure'
flash 'error', data.reason
$q.reject(data.errors)
$q.reject(data)
else
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