feat: import OpenProfile on connect (#280)

Co-authored-by: Anthony Ettinger <anthony@profullstack.com>
This commit is contained in:
sh1pt-actions-fleet[bot] 2026-11-01 14:23:39 +00:00 • committed by GitHub
parent 269b6e3e07
commit 53e08902cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 4 deletions

View file

@ -16,7 +16,7 @@
"@profullstack/key-rotation": "0.1.0",
"@profullstack/footer": "latest",
"@profullstack/libsql-pg": "^0.1.4",
"@profullstack/profile": "0.1.6",
"@profullstack/profile": "0.1.7",
"@simplewebauthn/browser": "^14.0.0",
"@simplewebauthn/server": "^14.0.3",
"cookie-parser": "^1.4.7",

View file

@ -5,6 +5,8 @@ import { config } from "../config.mjs";
import { token } from "../lib/crypto.mjs";
import { createSession, setCeremony, getCeremony, clearCeremony, takeNext } from "../lib/session.mjs";
import { userByCoinpay, createUserForCoinpay } from "../lib/users.mjs";
import { profiles } from "../lib/profile.mjs";
import { saveOpenProfileContact } from "@profullstack/profile";
export const coinpayRouter = Router();
@ -59,6 +61,13 @@ coinpayRouter.get("/auth/coinpay/callback", async (req, res) => {
let user = await userByCoinpay(sub);
if (!user) user = await createUserForCoinpay(sub, info.name || info.username);
if (typeof info.openprofile_url === "string") {
try {
await saveOpenProfileContact(profiles, String(user.id), info.openprofile_url);
} catch (e) {
console.warn("[coinpay] OpenProfile import skipped:", e instanceof Error ? e.message : e);
}
}
await createSession(res, user.id);
res.redirect(takeNext(req, res) || "/");
} catch (e) {

View file

@ -336,10 +336,11 @@ pagesRouter.get("/settings", requireAuth, async (req, res) => {
<div class="card" style="margin-bottom:20px"><div class="card-head"><span class="h">Your details</span></div>
<div class="card-body">
<form method="post" action="/settings/profile">${csrfInput(req)}
${renderProfileFields({ values: profileValues, required: ["first_name", "last_name"], idPrefix: "account-" })}
${renderProfileFields({ values: profileValues, required: ["first_name", "last_name"], idPrefix: "account-", importOpenProfile: true })}
<button class="btn">Save details</button>
</form>
</div></div>
<script src="/vendor/profile-enhance.js" defer></script>
<div class="card"><div class="card-head"><span class="h">API keys</span></div>
<div class="card-body">
<p class="dim" style="font-size:.85rem;margin-top:0">A <b>person</b> key acts as you; <code>logicsrc login</code> makes one for you. A <b>machine</b> key is for a deploy box or CI: one team, the vaults you list, read-only unless you say otherwise, its own identity key. After the box runs one command with it, grant it a vault from the vault page or with <code>logicsrc teams grant &lt;team&gt; &lt;project&gt; &lt;env&gt; --key &lt;name&gt;</code>.</p>