mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-04 02:29:06 +00:00
feat(settings): add a passkey or connect CoinPay to an existing account (#306)
Assisted recovery (#305) confirms with a passkey or a connected CoinPay identity, but an account that signed up by email had no way to get either: the passkey button exists only on the sign-in page, and Sign in with CoinPay only ever created a new account. - Settings > Vault email recovery shows what the account has and an "Add a passkey" button (the existing register endpoints, which already attach to the signed-in user). - "Connect CoinPay" (shown when CoinPay sign-in is configured) binds the CoinPay subject to the signed-in account. An identity that already belongs to another account is refused; an account keeps its first identity. Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
6ff3089088
commit
e04531b73a
5 changed files with 99 additions and 2 deletions
|
|
@ -26,4 +26,7 @@ export async function createUserPasskey(displayName) {
|
|||
|
||||
export const userByEmail = (email) => get(`SELECT * FROM users WHERE email = ?`, [String(email).toLowerCase()]);
|
||||
export const userByCoinpay = (sub) => get(`SELECT * FROM users WHERE coinpay_sub = ?`, [sub]);
|
||||
/** Connect a CoinPay identity to an existing account that has none. coinpay_sub is UNIQUE, so one identity is one account. */
|
||||
export const linkCoinpay = (userId, sub) =>
|
||||
run(`UPDATE users SET coinpay_sub = ? WHERE id = ? AND coinpay_sub IS NULL`, [sub, userId]);
|
||||
export const userById = (uid) => get(`SELECT * FROM users WHERE id = ?`, [uid]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue