mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-11-29 15:51:52 +00:00
feat: import OpenProfile on connect (#280)
Co-authored-by: Anthony Ettinger <anthony@profullstack.com>
This commit is contained in:
parent
269b6e3e07
commit
53e08902cb
4 changed files with 16 additions and 4 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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 <team> <project> <env> --key <name></code>.</p>
|
||||
|
|
|
|||
6
bun.lock
6
bun.lock
|
|
@ -87,7 +87,7 @@
|
|||
"@profullstack/footer": "latest",
|
||||
"@profullstack/key-rotation": "0.1.0",
|
||||
"@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",
|
||||
|
|
@ -773,7 +773,9 @@
|
|||
|
||||
"@profullstack/logicsrc-mcp": ["@profullstack/logicsrc-mcp@workspace:packages/logicsrc-mcp"],
|
||||
|
||||
"@profullstack/profile": ["@profullstack/profile@0.1.6", "", { "peerDependencies": { "@libsql/client": ">=0.6.0", "postgres": "^3.4.0", "react": ">=18" }, "optionalPeers": ["@libsql/client", "postgres", "react"], "bin": { "profile": "src/cli.js" } }, "sha512-xkn0P3ANz151QJdlBwcBXkHk813qW9qAmuTZKcuvpEZYkyHDC9J9KfvpVSRepfjECzz4ONGHWO5Zwc4BHpfK8g=="],
|
||||
"@profullstack/openprofile": ["@profullstack/openprofile@0.2.0", "", {}, "sha512-cdFsBbfRXurvy5KqHDNcKXxurK2s/YlfVgnILFRpVl2hq3860rExqDee8IfsFGxw5cPdqGv2fxUxtek1Xy2U5Q=="],
|
||||
|
||||
"@profullstack/profile": ["@profullstack/profile@0.1.7", "", { "dependencies": { "@profullstack/openprofile": "^0.2.0" }, "peerDependencies": { "@libsql/client": ">=0.6.0", "postgres": "^3.4.0", "react": ">=18" }, "optionalPeers": ["@libsql/client", "postgres", "react"], "bin": { "profile": "src/cli.js" } }, "sha512-N7UkypkkY2JkSBKzmdmyy6+DCoxI048qUZQksEjSRwSIyy4mjU9H1qW4yhZD+LJBhTEupgJv//Uxwhiy2FuGmA=="],
|
||||
|
||||
"@profullstack/referrals": ["@profullstack/referrals@0.1.0", "", { "peerDependencies": { "react": ">=18" }, "optionalPeers": ["react"] }, "sha512-u66SdBVpsv3kc0N+NWISPoYD5vjCERyv5wfD07iSkZwQeC2IA+ihX5jNA4e7Xr+Y4AUvxLycG+3b4VaROqzgRg=="],
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue