accounts: set nip05 during update_credentials

This commit is contained in:
Alex Gleason
2023-09-11 18:44:44 -05:00
parent 3394474ee2
commit 62ac9bffa3
3 changed files with 12 additions and 2 deletions

View File

@@ -32,8 +32,9 @@ type UserRole = 'user' | 'admin';
/** Require the user to prove their role before invoking the controller. */
function requireRole(role: UserRole, opts?: ParseAuthRequestOpts): AppMiddleware {
return withProof(async (_c, proof, next) => {
return withProof(async (c, proof, next) => {
const user = await findUser({ pubkey: proof.pubkey });
c.set('user', user);
if (user && matchesRole(user, role)) {
await next();