mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-25 00:04:22 +01:00
accounts: set nip05 during update_credentials
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user