stop deleting key-increment repeatedly

This commit is contained in:
Paul Liverman III 2018-04-24 07:00:01 -07:00
parent aa00d61ea4
commit 78f27e5835
2 changed files with 4 additions and 1 deletions

View File

@ -36,4 +36,7 @@ make_migrations {
[1524605427]: =>
add_column "api_keys", "id", types.serial primary_key: true
[1524607145]: =>
settings.set "simplex.key-increment", 100 -- I had been accidentally deleting this key over and over again
}

View File

@ -20,7 +20,7 @@ class APIKeys extends Model
values.key = encode_base64 bcrypt.digest "#{settings["simplex.key-increment"]}#{user.name}#{user.digest}", settings["users.bcrypt-digest-rounds"]
settings["simplex.key-increment"] += 1
unless APIKeys\find key: values.key
settings.set "simplex.key-increment"
settings.save "simplex.key-increment"
break
super values, opts