Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
fd5a1f02
Commit
fd5a1f02
authored
May 15, 2014
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propagate form errors to caller and flash for auth
Relates to #1200
parent
983b419f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
6 deletions
+17
-6
controllers.coffee
h/js/controllers.coffee
+16
-5
flash.coffee
h/js/flash.coffee
+1
-1
No files found.
h/js/controllers.coffee
View file @
fd5a1f02
...
...
@@ -701,24 +701,35 @@ class Auth
code
:
null
this
.
$inject
=
[
'$scope'
,
'authentication'
,
'$scope'
,
'authentication'
,
'flash'
]
constructor
:
(
$scope
,
authentication
$scope
,
authentication
,
flash
)
->
_reset
=
=>
angular
.
copy
@
scope
,
$scope
.
model
for
own
_
,
ctrl
of
$scope
when
typeof
ctrl
?
.
$setPristine
is
'function'
ctrl
.
$setPristine
()
_success
=
->
_reset
()
$scope
.
$emit
'success'
,
form
.
$name
_error
=
(
response
)
->
if
response
.
errors
# TODO: show these messages inline with the form
for
field
,
error
of
response
.
errors
console
.
log
(
field
,
error
)
flash
(
'error'
,
error
)
if
response
.
reason
flash
(
'error'
,
reason
)
$scope
.
$on
'$reset'
,
_reset
$scope
.
submit
=
(
form
)
->
angular
.
extend
authentication
,
$scope
.
model
return
unless
form
.
$valid
authentication
[
"$
#{
form
.
$name
}
"
]
->
_reset
()
$scope
.
$emit
'success'
,
form
.
$name
authentication
[
"$
#{
form
.
$name
}
"
]
_success
,
_error
class
Editor
...
...
h/js/flash.coffee
View file @
fd5a1f02
...
...
@@ -55,7 +55,7 @@ flashInterceptor = ['$q', 'flash', ($q, flash) ->
if
data
.
status
is
'failure'
flash
'error'
,
data
.
reason
$q
.
reject
(
data
.
reason
)
$q
.
reject
(
data
)
else
if
data
.
status
is
'okay'
and
data
.
model
response
.
data
=
data
.
model
response
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment