|
@@ -12,6 +12,7 @@ import { Admin } from '../entity/system/admin.entity';
|
|
|
import * as bcrypt from 'bcryptjs';
|
|
|
import { User } from '../entity/system/user.entity';
|
|
|
import { AliyunSmsService } from './thirdParty/aliyunSms.service';
|
|
|
+import { EmailService } from './thirdParty/email.service';
|
|
|
|
|
|
@Provide()
|
|
|
export class LoginService {
|
|
@@ -37,6 +38,8 @@ export class LoginService {
|
|
|
|
|
|
@Inject()
|
|
|
smsService: AliyunSmsService;
|
|
|
+ @Inject()
|
|
|
+ emailService: EmailService;
|
|
|
|
|
|
@InjectEntityModel(Admin)
|
|
|
adminModel: Repository<Admin>;
|
|
@@ -69,6 +72,7 @@ export class LoginService {
|
|
|
await this.redisService.set(redisKey, code, 'EX', this.timeLimit);
|
|
|
if (type === 'email') {
|
|
|
// TODO: 发邮箱
|
|
|
+ await this.emailService.sendPwdCode(to, code);
|
|
|
} else if (type === 'phone') {
|
|
|
// 发短信
|
|
|
await this.smsService.send(to, code);
|