mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
perf: 邮箱验证优化流程提示
This commit is contained in:
parent
c1bdd079cf
commit
a9f28dfb47
@ -602,12 +602,14 @@ class UsersController extends AbstractController
|
|||||||
}
|
}
|
||||||
// 如果已经校验过
|
// 如果已经校验过
|
||||||
if (intval($res->status) === 1)
|
if (intval($res->status) === 1)
|
||||||
return Base::retError('链接已经使用过');
|
return Base::retError('链接已经使用过',['code' => 2]);
|
||||||
|
|
||||||
$oldTime = strtotime($res->created_at);
|
$oldTime = strtotime($res->created_at);
|
||||||
$time = time();
|
$time = time();
|
||||||
//24个小时失效
|
//24个小时失效
|
||||||
if (abs($time - $oldTime) > 86400) {
|
if (abs($time - $oldTime) > 86400) {
|
||||||
|
$user = User::whereUserid($res->userid)->first();
|
||||||
|
UserEmailVerification::userEmailSend($user);
|
||||||
return Base::retError("链接已失效");
|
return Base::retError("链接已失效");
|
||||||
}
|
}
|
||||||
UserEmailVerification::where('code', $data['code'])
|
UserEmailVerification::where('code', $data['code'])
|
||||||
|
|||||||
@ -187,6 +187,12 @@ class User extends AbstractModel
|
|||||||
throw new ApiException('请输入正确的邮箱地址');
|
throw new ApiException('请输入正确的邮箱地址');
|
||||||
}
|
}
|
||||||
if (User::email2userid($email) > 0) {
|
if (User::email2userid($email) > 0) {
|
||||||
|
$isRegVerify = Base::settingFind('emailSetting', 'reg_verify') === 'open' ? true : false;
|
||||||
|
$user = self::whereUserid(User::email2userid($email))->first();
|
||||||
|
if ($isRegVerify && $user->is_email_verity === 0) {
|
||||||
|
UserEmailVerification::userEmailSend($user);
|
||||||
|
throw new ApiException('您的账号已注册过,请验证邮箱');
|
||||||
|
}
|
||||||
throw new ApiException('邮箱地址已存在');
|
throw new ApiException('邮箱地址已存在');
|
||||||
}
|
}
|
||||||
//密码
|
//密码
|
||||||
|
|||||||
@ -8,9 +8,7 @@
|
|||||||
<p>{{$L('今后您可以通过此邮箱重置您的账号密码')}}</p>
|
<p>{{$L('今后您可以通过此邮箱重置您的账号密码')}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="validation-text" v-if="error">
|
<div class="validation-text" v-if="error">
|
||||||
<div>{{$L('您的邮箱未通过验证,可能的原因:')}}</div>
|
<div>{{$L('链接已过期,请重新发送')}}</div>
|
||||||
<div>{{$L('1.验证码已过期')}}</div>
|
|
||||||
<div>{{$L('2.重复使用验证码')}}</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div slot="footer" v-if="success">
|
<div slot="footer" v-if="success">
|
||||||
<Button type="primary" @click="userLogout" long>{{$L('返回首页')}}</Button>
|
<Button type="primary" @click="userLogout" long>{{$L('返回首页')}}</Button>
|
||||||
@ -46,11 +44,14 @@ export default {
|
|||||||
.then(({data}) => {
|
.then(({data}) => {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
this.error = false;
|
this.error = false;
|
||||||
})
|
}).catch(({data, msg}) => {
|
||||||
.catch(() => {
|
if (data.code === 2) {
|
||||||
|
this.goForward({path: '/'}, true);
|
||||||
|
} else {
|
||||||
this.success = false;
|
this.success = false;
|
||||||
this.error = true;
|
this.error = true;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
userLogout() {
|
userLogout() {
|
||||||
this.$store.dispatch("logout", false)
|
this.$store.dispatch("logout", false)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user