mirror of https://github.com/fantasticit/think.git
parent
7acb70ae59
commit
af6a5e08db
|
@ -26,7 +26,7 @@ export class UserService {
|
||||||
@InjectRepository(UserEntity)
|
@InjectRepository(UserEntity)
|
||||||
private readonly userRepo: Repository<UserEntity>,
|
private readonly userRepo: Repository<UserEntity>,
|
||||||
|
|
||||||
private readonly confifgService: ConfigService,
|
private readonly configService: ConfigService,
|
||||||
|
|
||||||
@Inject(forwardRef(() => JwtService))
|
@Inject(forwardRef(() => JwtService))
|
||||||
private readonly jwtService: JwtService,
|
private readonly jwtService: JwtService,
|
||||||
|
@ -60,7 +60,7 @@ export class UserService {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = await this.confifgService.get('server.admin');
|
const config = await this.configService.get('server.admin');
|
||||||
|
|
||||||
if (!config.name || !config.password || !config.email) {
|
if (!config.name || !config.password || !config.email) {
|
||||||
throw new Error(`请指定名称、密码和邮箱`);
|
throw new Error(`请指定名称、密码和邮箱`);
|
||||||
|
@ -225,7 +225,7 @@ export class UserService {
|
||||||
|
|
||||||
const res = instanceToPlain(existUser) as IUser;
|
const res = instanceToPlain(existUser) as IUser;
|
||||||
const token = this.jwtService.sign(res);
|
const token = this.jwtService.sign(res);
|
||||||
const domain = this.confifgService.get('client.siteDomain');
|
const domain = this.configService.get('client.siteDomain');
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const expiresIn = this.jwtService.decode(token, { complete: true }).payload.exp;
|
const expiresIn = this.jwtService.decode(token, { complete: true }).payload.exp;
|
||||||
|
@ -233,7 +233,7 @@ export class UserService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async logout() {
|
async logout() {
|
||||||
const domain = this.confifgService.get('client.siteDomain');
|
const domain = this.configService.get('client.siteDomain');
|
||||||
return { token: '', domain };
|
return { token: '', domain };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue