Skip to content

feat(users): Created user managment & administration system.#16

Closed
AdenMGB wants to merge 10 commits into
Drop-OSS:developfrom
AdenMGB:user-system
Closed

feat(users): Created user managment & administration system.#16
AdenMGB wants to merge 10 commits into
Drop-OSS:developfrom
AdenMGB:user-system

Conversation

@AdenMGB

@AdenMGB AdenMGB commented Jan 12, 2025

Copy link
Copy Markdown
Contributor

Authentication System

Note: Does NOT include sign out functionality, it is on a separate PR (#15)

What this does include:

  • Manual user; creation, deletion, promotion & password resetting
  • User search ability
  • Account detail modification
  • Tweaks

@DecDuck DecDuck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might need to spend more time looking over how the backend is written.

I don't want to seem rude, but this isn't really well done.

Comment thread pages/account/index.vue

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I get some screenshots?

Comment thread pages/account/index.vue
</div>

<!-- Save Button -->
<div class="flex justify-end pt-4">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole form should be wrapped in a

element, and we should use @submit.prevent on the form, instead of @click on the button

Comment thread pages/account/index.vue
})

// Save changes
async function saveChanges() {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function shouldn't have a try-catch, instead using a saveChanges_wrapper that uses then, catch and finally.

Also should use an error component that renders in the form, rather than a modal. Check other forms (like signin or admin metadata import) for an example.

name: "User Management",
enabled: true,
icon: UserGroupIcon,
route: "/admin/auth/users",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we refactor to /admin/users and then auth is under /admin/users/auth

Comment thread pages/index.vue

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeated from the other PR?

}

// Validate password
if (!body.password || typeof body.password !== 'string' || body.password.length < 14) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably be refactored as a single function in server/internal/security

},
});

return {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to result a success message, just a 200/201 response (default)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be split into separate user.get.ts, user.patch.ts and user.delete.ts. I can't review it properly if it's all in one file.

import { defineEventHandler, readBody, createError } from "h3";
import prisma from "~/server/internal/db/database";

export default defineEventHandler(async (event) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use h3 instead of event as this arg (I think this also needs to be updated elsewhere)

});
}

const body = await readBody(event);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We break out body into stuff like this:

const body = await readBody(event);
const displayName = body.displayName;
const email = body.email;

That lets us do multiple checks without repeating ourselves.

@AdenMGB

AdenMGB commented Jan 12, 2025

Copy link
Copy Markdown
Contributor Author

Ah well, don't be sorry there's a reason I'm mainly front end developer haha. At least I gave it a go, thanks for the feedback though.

@AdenMGB AdenMGB closed this Jan 12, 2025
Huskydog9988 pushed a commit to Huskydog9988/drop that referenced this pull request Apr 16, 2026
* Create account.vue with logout button

* Update auth.rs to add signout command

* Update lib.rs to pass sign_out command to frontend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants