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
570f2b16
Commit
570f2b16
authored
Oct 13, 2015
by
Sean Hammond
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2582 from hypothesis/replace-accounts-forms
Server-rendered accounts forms
parents
c36acd9d
8a46ae38
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
72 additions
and
364 deletions
+72
-364
account-controller.js
h/static/scripts/account-controller.js
+1
-1
account.js
h/static/scripts/account/account.js
+0
-73
app.coffee
h/static/scripts/app.coffee
+2
-0
auth-controller.js
h/static/scripts/auth-controller.js
+1
-20
session.js
h/static/scripts/session.js
+0
-3
account-controller-test.coffee
h/static/scripts/test/account-controller-test.coffee
+4
-4
auth-controller-test.coffee
h/static/scripts/test/auth-controller-test.coffee
+1
-1
common.scss
h/static/styles/common.scss
+7
-0
auth.html
h/templates/client/auth.html
+56
-262
No files found.
h/static/scripts/account
/account
-controller.js
→
h/static/scripts/account-controller.js
View file @
570f2b16
...
...
@@ -144,4 +144,4 @@ function AccountController($scope, $filter, auth, flash, formRespond, identity,
};
}
angular
.
module
(
'h'
).
controller
(
'AccountController'
,
AccountController
)
;
module
.
exports
=
AccountController
;
h/static/scripts/account/account.js
deleted
100644 → 0
View file @
c36acd9d
var
angular
=
require
(
'angular'
);
// @ngInject
function
AuthAppController
(
$location
,
$scope
,
$timeout
,
$window
,
session
)
{
function
onlogin
()
{
window
.
location
.
href
=
'/stream'
;
};
$scope
.
account
=
{};
$scope
.
model
=
{};
$scope
.
account
.
tab
=
$location
.
path
().
split
(
'/'
)[
1
];
$scope
.
$on
(
'auth'
,
function
(
event
,
err
,
data
)
{
if
(
data
!=
null
?
data
.
userid
:
void
0
)
{
$timeout
(
onlogin
,
1000
);
}
});
$scope
.
$watch
(
'account.tab'
,
function
(
tab
,
old
)
{
if
(
tab
!==
old
)
{
$location
.
path
(
'/'
+
tab
);
}
});
// TODO: We should be calling identity.beginProvisioning() here in order to
// move toward become a federated BrowserID provider.
session
.
load
(
function
(
data
)
{
if
(
data
.
userid
)
{
onlogin
();
}
});
}
// @ngInject
function
AuthPageController
(
$routeParams
,
$scope
)
{
$scope
.
model
.
code
=
$routeParams
.
code
;
$scope
.
hasActivationCode
=
!!
$routeParams
.
code
;
}
// @ngInject
function
configure
(
$httpProvider
,
$locationProvider
,
$routeProvider
)
{
// Use the Pyramid XSRF header name
$httpProvider
.
defaults
.
xsrfHeaderName
=
'X-CSRF-Token'
;
$locationProvider
.
html5Mode
(
true
);
$routeProvider
.
when
(
'/login'
,
{
controller
:
'AuthPageController'
,
templateUrl
:
'auth.html'
});
$routeProvider
.
when
(
'/register'
,
{
controller
:
'AuthPageController'
,
templateUrl
:
'auth.html'
});
$routeProvider
.
when
(
'/forgot_password'
,
{
controller
:
'AuthPageController'
,
templateUrl
:
'auth.html'
});
$routeProvider
.
when
(
'/reset_password/:code?'
,
{
controller
:
'AuthPageController'
,
templateUrl
:
'auth.html'
});
}
angular
.
module
(
'h'
)
.
config
(
configure
)
.
controller
(
'AuthAppController'
,
AuthAppController
)
.
controller
(
'AuthPageController'
,
AuthPageController
);
require
(
'./account-controller'
);
require
(
'./auth-controller'
);
h/static/scripts/app.coffee
View file @
570f2b16
...
...
@@ -98,8 +98,10 @@ module.exports = angular.module('h', [
])
.
controller
(
'AppController'
,
require
(
'./app-controller'
))
.
controller
(
'AccountController'
,
require
(
'./account-controller'
))
.
controller
(
'AnnotationUIController'
,
require
(
'./annotation-ui-controller'
))
.
controller
(
'AnnotationViewerController'
,
require
(
'./annotation-viewer-controller'
))
.
controller
(
'AuthController'
,
require
(
'./auth-controller'
))
.
controller
(
'StreamController'
,
require
(
'./stream-controller'
))
.
controller
(
'WidgetController'
,
require
(
'./widget-controller'
))
...
...
h/static/scripts/a
ccount/a
uth-controller.js
→
h/static/scripts/auth-controller.js
View file @
570f2b16
...
...
@@ -7,19 +7,6 @@ function AuthController($scope, $timeout, flash, session, formRespond) {
$scope
.
$emit
(
'auth'
,
null
,
data
);
}
$scope
.
account
.
tab
=
(
function
()
{
switch
(
$scope
.
account
.
tab
)
{
case
'register'
:
return
'login'
;
case
'forgot_password'
:
return
'reset_password'
;
case
'reset_password'
:
return
'login'
;
default
:
return
$scope
.
account
.
tab
;
}
})();
angular
.
copy
({},
$scope
.
model
);
if
(
$scope
.
form
!=
null
)
{
...
...
@@ -78,12 +65,6 @@ function AuthController($scope, $timeout, flash, session, formRespond) {
});
};
if
(
$scope
.
account
==
null
)
{
$scope
.
account
=
{
tab
:
'login'
};
}
if
(
$scope
.
model
==
null
)
{
$scope
.
model
=
{};
}
...
...
@@ -106,4 +87,4 @@ function AuthController($scope, $timeout, flash, session, formRespond) {
});
}
angular
.
module
(
'h'
).
controller
(
'AuthController'
,
AuthController
)
;
module
.
exports
=
AuthController
;
h/static/scripts/session.js
View file @
570f2b16
...
...
@@ -8,9 +8,6 @@ var CACHE_TTL = 5 * 60 * 1000; // 5 minutes
var
ACCOUNT_ACTIONS
=
[
[
'login'
,
'POST'
],
[
'logout'
,
'POST'
],
[
'register'
,
'POST'
],
[
'forgot_password'
,
'POST'
],
[
'reset_password'
,
'POST'
],
[
'profile'
,
'GET'
],
[
'edit_profile'
,
'POST'
],
[
'disable_user'
,
'POST'
]
...
...
h/static/scripts/
account/
test/account-controller-test.coffee
→
h/static/scripts/test/account-controller-test.coffee
View file @
570f2b16
...
...
@@ -15,7 +15,7 @@ describe 'h:AccountController', ->
before
->
angular
.
module
(
'h'
,
[])
require
(
'../account-controller'
)
.
controller
(
'AccountController'
,
require
(
'../account-controller'
)
)
beforeEach
module
(
'h'
)
...
...
@@ -241,7 +241,7 @@ describe "h:AccountController", ->
# The h module hasn't been defined yet, so we need to define it
# (this happens when it.only() is used in this describe()).
angular
.
module
(
"h"
,
[])
require
(
"../account-controller"
)
.
controller
(
'AccountController'
,
require
(
'../account-controller'
)
)
)
beforeEach
module
(
'h'
)
...
...
@@ -379,7 +379,7 @@ describe "h:AccountController", ->
}
{
$scope
}
=
createAccountController
(
formRespond
:
require
(
"../
../
form-respond"
)()
formRespond
:
require
(
"../form-respond"
)()
session
:
getStubSession
(
edit_profile
:
->
{
$promise
:
Promise
.
reject
(
server_response
)}
)
...
...
@@ -451,7 +451,7 @@ describe "h:AccountController", ->
}
{
$scope
}
=
createAccountController
(
formRespond
:
require
(
"../
../
form-respond"
)()
formRespond
:
require
(
"../form-respond"
)()
session
:
getStubSession
(
edit_profile
:
->
{
$promise
:
Promise
.
reject
(
server_response
)}
)
...
...
h/static/scripts/
account/
test/auth-controller-test.coffee
→
h/static/scripts/test/auth-controller-test.coffee
View file @
570f2b16
...
...
@@ -27,7 +27,7 @@ describe 'h:AuthController', ->
before
->
angular
.
module
(
'h'
,
[])
require
(
'../auth-controller'
)
.
controller
(
'AuthController'
,
require
(
'../auth-controller'
)
)
beforeEach
module
(
'h'
)
beforeEach
module
(
'h.templates'
)
...
...
h/static/styles/common.scss
View file @
570f2b16
...
...
@@ -125,6 +125,13 @@ html {
.form-inline
.control-group
{
margin-bottom
:
0
;
}
.form-vertical
{
legend
{
font-size
:
$body1-font-size
;
line-height
:
$body1-line-height
;
margin-top
:
1
.5em
;
margin-bottom
:
1
.5em
;
}
select
,
textarea
,
input
,
button
{
display
:
block
;
// margin-top: .75em;
...
...
h/templates/client/auth.html
View file @
570f2b16
This diff is collapsed.
Click to expand it.
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