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
b67e28de
Commit
b67e28de
authored
Jul 23, 2014
by
Randall Leeds
Committed by
Aron Carroll
Jul 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Break out callbacks in auth controller
parent
6eaf2e6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
auth.coffee
h/static/scripts/auth.coffee
+23
-23
No files found.
h/static/scripts/auth.coffee
View file @
b67e28de
...
...
@@ -8,6 +8,28 @@ class AuthController
constructor
:
(
$scope
,
$timeout
,
session
)
->
timeout
=
null
success
=
->
$scope
.
model
=
null
$scope
.
$broadcast
'success'
failure
=
(
form
,
response
)
->
{
errors
,
reason
}
=
response
.
data
if
reason
if
reason
==
'Invalid username or password.'
form
.
password
.
$setValidity
(
'response'
,
false
)
form
.
password
.
responseErrorMessage
=
reason
else
form
.
responseErrorMessage
=
reason
else
form
.
responseErrorMessage
=
null
for
field
,
error
of
errors
form
[
field
].
$setValidity
(
'response'
,
false
)
form
[
field
].
responseErrorMessage
=
error
$scope
.
$broadcast
'error'
,
form
.
$name
this
.
submit
=
(
form
)
->
return
unless
form
.
$valid
...
...
@@ -18,29 +40,7 @@ class AuthController
delete
session
[
key
]
angular
.
extend
session
,
$scope
.
model
session
[
method
](
(
session
)
->
$scope
.
model
=
null
$scope
.
$broadcast
'success'
,
(
response
)
->
{
errors
,
reason
}
=
response
.
data
if
reason
if
reason
==
'Invalid username or password.'
form
.
password
.
$setValidity
(
'response'
,
false
)
form
.
password
.
responseErrorMessage
=
reason
else
form
.
responseErrorMessage
=
reason
else
form
.
responseErrorMessage
=
null
for
field
,
error
of
errors
form
[
field
].
$setValidity
(
'response'
,
false
)
form
[
field
].
responseErrorMessage
=
error
$scope
.
$broadcast
'error'
,
form
.
$name
)
session
[
method
]
success
,
angular
.
bind
(
this
,
failure
,
form
)
$scope
.
$on
'$destroy'
,
->
if
timeout
...
...
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