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
5affeaef
Commit
5affeaef
authored
12 years ago
by
Lloyd Hilaiel
Browse files
Options
Downloads
Patches
Plain Diff
cleanup transitional code for migration from email to userid in stage table - issue #1599
parent
4dab9470
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/db/mysql.js
+17
-23
17 additions, 23 deletions
lib/db/mysql.js
with
17 additions
and
23 deletions
lib/db/mysql.js
+
17
−
23
View file @
5affeaef
...
...
@@ -355,32 +355,26 @@ exports.gotVerificationSecret = function(secret, cb) {
addEmailToUser
(
info
.
insertId
,
o
.
email
,
'
secondary
'
,
cb
);
});
}
else
{
// we need a userid. the old schema had an 'existing' field which was an email
// address. the new schema has an 'existing_user' field which is a userid.
// this is transitional code so outstanding verification links continue working
// and can be removed in feb 2012 some time. maybe for valentines day?
if
(
typeof
o
.
existing_user
===
'
number
'
)
doAddEmailSetPassword
(
o
.
existing_user
);
else
if
(
typeof
o
.
existing
===
'
string
'
)
{
exports
.
emailToUID
(
o
.
existing
,
function
(
uid
)
{
if
(
err
||
uid
===
undefined
)
return
cb
(
'
acct associated with staged email doesn
\'
t exist
'
);
doAddEmailSetPassword
(
uid
);
});
// ensure the expected existing_user field is populated, which it must always be when
// new_acct is false
if
(
typeof
o
.
existing_user
!==
'
number
'
)
{
return
cb
(
"
data inconsistency, no numeric existing user associated with staged email address
"
);
}
function
doAddEmailSetPassword
(
uid
)
{
// we're adding an email address to an existing user account. add appropriate entries into
// email table
var
hash
=
o
.
passwd
;
if
(
hash
)
{
exports
.
updatePassword
(
uid
,
hash
,
function
(
err
)
{
if
(
err
)
return
cb
(
'
could not set user
\'
s password
'
);
addEmailToUser
(
uid
,
o
.
email
,
'
secondary
'
,
cb
);
});
}
else
{
// we're adding an email address to an existing user account. add appropriate entries into
// email table
var
hash
=
o
.
passwd
;
var
uid
=
o
.
existing_user
;
if
(
hash
)
{
exports
.
updatePassword
(
uid
,
hash
,
function
(
err
)
{
if
(
err
)
return
cb
(
'
could not set user
\'
s password
'
);
addEmailToUser
(
uid
,
o
.
email
,
'
secondary
'
,
cb
);
}
});
}
else
{
addEmailToUser
(
uid
,
o
.
email
,
'
secondary
'
,
cb
);
}
}
;
}
}
}
;
}
);
}
...
...
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