Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: created_at in totp devices #169

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static String getQueryToCreateUserDevicesTable(Start start) {
+ "period INTEGER NOT NULL,"
+ "skew INTEGER NOT NULL,"
+ "verified BOOLEAN NOT NULL,"
+ "created_at BIGINT,"
+ "CONSTRAINT " + Utils.getConstraintName(schema, tableName, null, "pkey")
+ " PRIMARY KEY (app_id, user_id, device_name),"
+ "CONSTRAINT " + Utils.getConstraintName(schema, tableName, "user_id", "fkey")
Expand Down Expand Up @@ -121,7 +122,7 @@ private static int insertUser_Transaction(Start start, Connection con, AppIdenti
private static int insertDevice_Transaction(Start start, Connection con, AppIdentifier appIdentifier, TOTPDevice device)
throws SQLException, StorageQueryException {
String QUERY = "INSERT INTO " + Config.getConfig(start).getTotpUserDevicesTable()
+ " (app_id, user_id, device_name, secret_key, period, skew, verified) VALUES (?, ?, ?, ?, ?, ?, ?)";
+ " (app_id, user_id, device_name, secret_key, period, skew, verified, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";

return update(con, QUERY, pst -> {
pst.setString(1, appIdentifier.getAppId());
Expand All @@ -131,6 +132,7 @@ private static int insertDevice_Transaction(Start start, Connection con, AppIden
pst.setInt(5, device.period);
pst.setInt(6, device.skew);
pst.setBoolean(7, device.verified);
pst.setLong(8, System.currentTimeMillis());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we also get this value when reading a totp device?

});
}

Expand Down
Loading