|
@@ -20,7 +20,7 @@ class LoginService extends CrudService {
|
|
|
async login(data) {
|
|
|
const { mobile, passwd } = data;
|
|
|
assert(mobile, 'mobile不能为空');
|
|
|
- assert(/^\d{11}$/i.test(mobile), 'mobile无效');
|
|
|
+ // assert(/^\d{11}$/i.test(mobile), 'mobile无效');
|
|
|
assert(passwd, 'passwd不能为空');
|
|
|
const res = await this.uModel.findOne({ mobile }, '+passwd');
|
|
|
if (!res) {
|
|
@@ -56,10 +56,8 @@ class LoginService extends CrudService {
|
|
|
_userid = uid.toString();
|
|
|
res = await this.stuModel.findById(_userid);
|
|
|
}
|
|
|
- res.userid = _userid;
|
|
|
- res.openid = openid;
|
|
|
- res.type = type;
|
|
|
- const token = await jwt.sign(res, secret, { expiresIn, issuer, subject });
|
|
|
+ const newdata = { userid: _userid, ...res, openid, type };
|
|
|
+ const token = await jwt.sign(newdata, secret, { expiresIn, issuer, subject });
|
|
|
return token;
|
|
|
}
|
|
|
|