增加用户登录、登出、修改密码和增加用户的日志记录

This commit is contained in:
falcon 2020-04-13 08:49:04 +08:00
parent 7821b0b705
commit 6854cfbaec

View File

@ -58,6 +58,7 @@ namespace FAuth.Controllers.api
fir.LastLoginDatetime = now;
fir.Status |= FUserStatusEnum.Login;
this.Db.SaveChangesAsync().Wait();
this.Logger.LogInformation($"用户{userName}登录成功!");
return new CheckUserResult {
Ticket = this.UserTicketDryptor.Encrypt(new UserTicketModel {
Id = fir.Id,
@ -85,6 +86,7 @@ namespace FAuth.Controllers.api
fir.Status &= ~FUserStatusEnum.Login;
fir.LastLogoutDatetime = DateTimeOffset.Now;
this.Db.SaveChangesAsync().Wait();
this.Logger.LogInformation($"用户{userTicketModel.Id}:{userTicketModel.UserName}登出成功!");
return true;
}
@ -135,6 +137,7 @@ namespace FAuth.Controllers.api
item.Password = nPassword;
}
this.Db.SaveChangesAsync().Wait();
this.Logger.LogInformation($"用户{userTicketModel.Id}:{userTicketModel.UserName}修改密码成功!");
return true;
}
@ -167,6 +170,7 @@ namespace FAuth.Controllers.api
};
this.Db.Entry(nUser).State = EntityState.Added;
this.Db.SaveChangesAsync().Wait();
this.Logger.LogInformation($"用户{nUser.Id}:{nUser.UserName}:{nUser.Name}添加成功!");
return true;
}
}