拆分 OAuth 后置验证流程
This commit is contained in:
@@ -263,11 +263,13 @@
|
||||
6: 'wait-registration-success',
|
||||
7: 'oauth-login',
|
||||
8: 'fetch-login-code',
|
||||
9: 'confirm-oauth',
|
||||
10: 'platform-verify',
|
||||
9: 'post-login-phone-verification',
|
||||
10: 'confirm-oauth',
|
||||
11: 'fetch-login-code',
|
||||
12: 'confirm-oauth',
|
||||
13: 'platform-verify',
|
||||
12: 'post-login-phone-verification',
|
||||
13: 'confirm-oauth',
|
||||
14: 'platform-verify',
|
||||
15: 'platform-verify',
|
||||
});
|
||||
|
||||
function getStepKeyForState(step, state = {}) {
|
||||
@@ -647,6 +649,42 @@
|
||||
return;
|
||||
}
|
||||
|
||||
if (stepKey === 'post-login-phone-verification') {
|
||||
await setState({
|
||||
currentPhoneVerificationCode: '',
|
||||
signupPhoneVerificationRequestedAt: null,
|
||||
signupPhoneVerificationPurpose: '',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (stepKey === 'bind-email') {
|
||||
const updates = {};
|
||||
if (payload.bindEmailSubmitted !== undefined) {
|
||||
updates.bindEmailSubmitted = Boolean(payload.bindEmailSubmitted);
|
||||
}
|
||||
if (payload.email !== undefined) {
|
||||
updates.email = payload.email || null;
|
||||
}
|
||||
if (payload.step8VerificationTargetEmail !== undefined) {
|
||||
updates.step8VerificationTargetEmail = payload.step8VerificationTargetEmail || '';
|
||||
}
|
||||
if (Object.keys(updates).length) {
|
||||
await setState(updates);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (stepKey === 'fetch-bind-email-code') {
|
||||
await setState({
|
||||
lastEmailTimestamp: payload.emailTimestamp || null,
|
||||
loginVerificationRequestedAt: null,
|
||||
step8VerificationTargetEmail: '',
|
||||
bindEmailSubmitted: false,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (stepKey === 'confirm-oauth') {
|
||||
if (payload.localhostUrl) {
|
||||
if (!isLocalhostOAuthCallbackUrl(payload.localhostUrl)) {
|
||||
|
||||
Reference in New Issue
Block a user