Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
8a63fbd9
Commit
8a63fbd9
authored
12 years ago
by
Zachary Carter
Browse files
Options
Downloads
Patches
Plain Diff
User should not have to auth when email added/verified on same browser
parent
ff37329a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/wsapi/email_for_token.js
+2
-1
2 additions, 1 deletion
lib/wsapi/email_for_token.js
tests/forgotten-pass-test.js
+49
-1
49 additions, 1 deletion
tests/forgotten-pass-test.js
with
51 additions
and
2 deletions
lib/wsapi/email_for_token.js
+
2
−
1
View file @
8a63fbd9
...
@@ -55,7 +55,8 @@ exports.process = function(req, res) {
...
@@ -55,7 +55,8 @@ exports.process = function(req, res) {
req
.
params
.
token
===
req
.
session
.
pendingCreation
)
{
req
.
params
.
token
===
req
.
session
.
pendingCreation
)
{
must_auth
=
false
;
must_auth
=
false
;
}
}
else
if
(
typeof
req
.
session
.
pendingReverification
===
'
string
'
)
{
else
if
(
typeof
req
.
session
.
pendingReverification
===
'
string
'
||
typeof
req
.
session
.
pendingAddition
===
'
string
'
)
{
must_auth
=
false
;
must_auth
=
false
;
}
}
// NOTE: for reverification, we require you're authenticated. it's not enough
// NOTE: for reverification, we require you're authenticated. it's not enough
...
...
This diff is collapsed.
Click to expand it.
tests/forgotten-pass-test.js
+
49
−
1
View file @
8a63fbd9
...
@@ -25,6 +25,9 @@ start_stop.addStartupBatches(suite);
...
@@ -25,6 +25,9 @@ start_stop.addStartupBatches(suite);
// var 'token'
// var 'token'
var
token
=
undefined
;
var
token
=
undefined
;
// stores wsapi client context
var
oldContext
;
// create a new account via the api with (first address)
// create a new account via the api with (first address)
suite
.
addBatch
({
suite
.
addBatch
({
"
staging an account
"
:
{
"
staging an account
"
:
{
...
@@ -101,6 +104,52 @@ suite.addBatch({
...
@@ -101,6 +104,52 @@ suite.addBatch({
}
}
});
});
// should not require auth to complete
suite
.
addBatch
({
"
given a token, getting an email
"
:
{
topic
:
function
()
{
wsapi
.
get
(
'
/wsapi/email_for_token
'
,
{
token
:
token
}).
call
(
this
);
},
"
account created
"
:
function
(
err
,
r
)
{
assert
.
equal
(
r
.
code
,
200
);
var
body
=
JSON
.
parse
(
r
.
body
);
assert
.
strictEqual
(
body
.
success
,
true
);
assert
.
strictEqual
(
body
.
must_auth
,
false
);
}
}
});
// New context for a second client
suite
.
addBatch
({
"
change context
"
:
function
()
{
oldContext
=
wsapi
.
getContext
();
wsapi
.
setContext
({});
}
});
// should require auth to complete for second client
suite
.
addBatch
({
"
given a token, getting an email
"
:
{
topic
:
function
()
{
wsapi
.
get
(
'
/wsapi/email_for_token
'
,
{
token
:
token
}).
call
(
this
);
},
"
account created
"
:
function
(
err
,
r
)
{
assert
.
equal
(
r
.
code
,
200
);
var
body
=
JSON
.
parse
(
r
.
body
);
assert
.
strictEqual
(
body
.
success
,
true
);
assert
.
strictEqual
(
body
.
must_auth
,
true
);
}
}
});
// restore context of first client
suite
.
addBatch
({
"
restore context
"
:
function
()
{
wsapi
.
setContext
(
oldContext
);
}
});
// confirm second email email address to the account
// confirm second email email address to the account
suite
.
addBatch
({
suite
.
addBatch
({
"
create second account
"
:
{
"
create second account
"
:
{
...
@@ -290,7 +339,6 @@ suite.addBatch({
...
@@ -290,7 +339,6 @@ suite.addBatch({
// browser should be prompted to authenticate
// browser should be prompted to authenticate
// New context for a second client
// New context for a second client
var
oldContext
;
suite
.
addBatch
({
suite
.
addBatch
({
"
change context
"
:
function
()
{
"
change context
"
:
function
()
{
oldContext
=
wsapi
.
getContext
();
oldContext
=
wsapi
.
getContext
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment