1
0
mirror of https://git.teknik.io/Teknikode/Teknik.git synced 2023-08-02 14:16:22 +02:00

Added check to make sure token is unique

This commit is contained in:
Uncled1023 2021-12-16 20:34:20 -08:00
parent 73ae766db5
commit ba8c0bb1b1

View File

@ -756,6 +756,10 @@ namespace Teknik.IdentityServer.Controllers
{
// Generate a unique token
var token = StringHelper.RandomString(40, "abcdefghjkmnpqrstuvwxyz1234567890");
while (dbContext.AuthTokens.FirstOrDefault(t => t.Token == token) != null)
{
token = StringHelper.RandomString(40, "abcdefghjkmnpqrstuvwxyz1234567890");
}
var authToken = new AuthToken()
{
AuthTokenId = Guid.NewGuid(),