mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-27 00:20:48 +08:00
feat: 注册流程优化
This commit is contained in:
@@ -70,8 +70,12 @@ export default {
|
||||
toast.success('登录成功')
|
||||
this.$router.push('/')
|
||||
} else if (data.reason_code === 'NOT_VERIFIED') {
|
||||
toast.info('当前邮箱未验证,请先重新填写注册页面并验证')
|
||||
this.$router.push('/signup')
|
||||
sessionStorage.setItem('signup_username', data.username)
|
||||
toast.info('当前邮箱未验证,已经为您重新发送验证码')
|
||||
this.$router.push({ path: '/signup', query: { verify: 1, u: this.username } })
|
||||
} else if (data.reason_code === 'NOT_APPROVED') {
|
||||
toast.info('您的注册正在审批中, 请留意邮件')
|
||||
this.$router.push('/')
|
||||
} else {
|
||||
toast.error(data.error || '登录失败')
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ export default {
|
||||
}
|
||||
},
|
||||
async mounted() {
|
||||
this.username = this.$route.query.u || ''
|
||||
try {
|
||||
const res = await fetch(`${API_BASE_URL}/api/config`)
|
||||
if (res.ok) {
|
||||
@@ -114,7 +115,6 @@ export default {
|
||||
} catch {/* ignore */}
|
||||
if (this.$route.query.verify) {
|
||||
this.emailStep = 1
|
||||
this.username = sessionStorage.getItem('signup_username') || ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -181,7 +181,10 @@ export default {
|
||||
const res = await fetch(`${API_BASE_URL}/api/auth/verify`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ username: this.username, code: this.code })
|
||||
body: JSON.stringify({
|
||||
code: this.code,
|
||||
username: this.username
|
||||
})
|
||||
})
|
||||
this.isWaitingForEmailVerified = false
|
||||
const data = await res.json()
|
||||
@@ -205,7 +208,7 @@ export default {
|
||||
googleSignIn(() => {
|
||||
this.$router.push('/')
|
||||
}, () => {
|
||||
this.$router.push('/signup-reason')
|
||||
this.$router.push('/signup-reason?google=1')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export default {
|
||||
const data = await res.json()
|
||||
if (res.ok) {
|
||||
toast.success('验证码已发送,请查收邮箱')
|
||||
this.$router.push('/signup?verify=1')
|
||||
this.$router.push({ path: '/signup', query: { verify: 1, u: sessionStorage.getItem('signup_username') } })
|
||||
} else {
|
||||
toast.error(data.error || '发送失败')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user