在項(xiàng)目yapi-master\server\controllers\user.js文件中分別修改注冊和登錄方法缎玫;
在注冊方法(reg)的322行添加如下代碼:
????let?patt?=?/^\w+([\.-]?\w+)*@(郵箱名1|郵箱名2)\.com$/;
????if?(!patt.test(params.email))?{
??????return?(ctx.body?=?yapi.commons.resReturn(null,?400,?'只支持公司郵箱'));
????}
在登錄方法(login)的40行添加如下代碼:
????let?patt?=?/^\w+([\.-]?\w+)*@(郵箱名1|郵箱名2)\.com$/;
????if?(!patt.test(email))?{
??????return?(ctx.body?=?yapi.commons.resReturn(null,?400,?'只支持公司郵箱'));
????}