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
21898533
Commit
21898533
authored
Jul 16, 2014
by
Randall Leeds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move auth timeout into Auth controller
parent
8fe7dac7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
22 deletions
+21
-22
controllers.coffee
h/js/controllers.coffee
+21
-22
No files found.
h/js/controllers.coffee
View file @
21898533
...
...
@@ -42,8 +42,6 @@ class App
)
->
{
plugins
,
host
,
providers
}
=
annotator
_authTimeout
=
null
_reset
=
=>
delete
annotator
.
ongoing_edit
base
=
angular
.
copy
@
scope
...
...
@@ -52,19 +50,6 @@ class App
socialView
:
annotator
.
socialView
ongoingHighlightSwitch
:
false
_startAuthTimeout
=
->
# Reset the auth forms after five minutes of inactivity
if
_authTimeout
$timeout
.
cancel
_authTimeout
_authTimeout
=
$timeout
->
# Skip the reset if we're logged in
unless
$scope
.
model
.
persona
$scope
.
$broadcast
'reset'
flash
'info'
,
'For your security, the forms have been reset due to inactivity.'
,
300000
_reset
()
annotator
.
subscribe
'serviceDiscovery'
,
(
options
)
->
...
...
@@ -85,11 +70,6 @@ class App
$i
.
triggerHandler
(
'input'
)
,
200
# We hope this is long enough
$scope
.
$watchCollection
'model'
,
->
# (Re)start (i.e., delay) the authentication form timeout
unless
$scope
.
sheet
.
collapsed
_startAuthTimeout
()
$scope
.
$watch
'model.personas'
,
(
newValue
,
oldValue
)
=>
if
newValue
?
.
length
unless
$scope
.
model
.
persona
and
$scope
.
model
.
persona
in
newValue
...
...
@@ -191,6 +171,13 @@ class App
filter
=
streamfilter
.
getFilter
()
sock
.
send
(
JSON
.
stringify
({
filter
}))
$scope
.
$on
'authTimeout'
,
->
# Skip the reset if we're logged in
unless
$scope
.
model
.
persona
$scope
.
$broadcast
'reset'
flash
'info'
,
'For your security, the forms have been reset due to inactivity.'
$scope
.
$on
'showAuth'
,
(
event
,
show
=
true
)
->
$scope
.
sheet
.
collapsed
=
!
show
...
...
@@ -698,14 +685,16 @@ class Annotation
class
Auth
this
.
$inject
=
[
'$scope'
,
'session'
]
constructor
:
(
$scope
,
session
)
->
this
.
$inject
=
[
'$scope'
,
'
$timeout'
,
'
session'
]
constructor
:
(
$scope
,
$timeout
,
session
)
->
base
=
username
:
null
email
:
null
password
:
null
code
:
null
_timeout
=
null
_reset
=
->
delete
$scope
.
errors
angular
.
extend
$scope
.
model
,
base
...
...
@@ -719,8 +708,18 @@ class Auth
for
field
,
error
of
errors
$scope
.
errors
[
form
][
field
]
=
error
_startTimeout
=
->
# Reset the auth forms after five minutes of inactivity
if
_timeout
then
$timeout
.
cancel
_timeout
_timeout
=
$timeout
(
->
$scope
.
$emit
'authTimeout'
),
3000000
$scope
.
$on
'reset'
,
_reset
$scope
.
$watchCollection
'model'
,
->
# (Re)start (i.e., delay) the authentication form timeout
unless
$scope
.
sheet
.
collapsed
_startTimeout
()
$scope
.
submit
=
(
form
)
->
angular
.
extend
session
,
$scope
.
model
return
unless
form
.
$valid
...
...
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