Commit a45b9e69 authored by Randall Leeds's avatar Randall Leeds

Merge pull request #1186 from hypothesis/horus-overhaul

Overhaul horus view handling
parents eb47a5ff 68518bea
...@@ -44,18 +44,10 @@ flashInterceptor = ['$q', 'flash', ($q, flash) -> ...@@ -44,18 +44,10 @@ flashInterceptor = ['$q', 'flash', ($q, flash) ->
if format?.match /^application\/json/ if format?.match /^application\/json/
if data.flash? if data.flash?
for q, msgs of data.flash for q, msgs of data.flash
# Workaround for horus returning the same error for
# both the username and the password field, and thus
# flashing the same error message twice
if msgs.length is 2 and
msgs[0] is "Invalid username or password." and
msgs[1] is msgs[0]
msgs.pop()
ignoreStatus = true
flash q, msgs flash q, msgs
if data.status is 'failure' if data.status is 'failure'
flash 'error', data.reason unless ignoreStatus flash 'error', data.reason
$q.reject(data.reason) $q.reject(data.reason)
else if data.status is 'okay' and data.model else if data.status is 'okay' and data.model
response.data = data.model response.data = data.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