acmutd / acmutd/portal

[Feature Request] Customize authentication flow

Đang mở
#65 0 bình luận 0 reaction 2 người được giao Được @DedsecKnight nhận Xem trên GitHub
Data Layer New Feature UI/UX
Ngôn ngữ chính
TypeScript
Star
2
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

# Overview
Customize the authentication flow to prevent duplicate user accounts. Specifically to prevent officers from having duplicate accounts with their acmutd.co email.

The default functionality of NextAuth is to create a new user for each unique email. Since each officer is guaranteed to have a personal email and an acmutd.co email, this poses the problem where duplicate user accounts are created if an officer doesn't connect their acmutd.co account to their personal account.

This can be mitigated by customizing the sign in page to show every provider besides google internal acmutd.co. The officer is then forced to sign in with a personal account first.

An additional edge case is if an officer tries to sign in with google with their acmutd.co account. This can be prevented by handling using a sign in callback.

# Tasks
- [x] Customize sign-in page with all providers besides acmutd.co
- [x] Add callback to prevent acmutd.co domain emails from google sign in
- [ ] Display proper sign in page error messages with hints
- [ ] Document the authentication flow with diagrams
- [ ] Submit PR to NextAuth's documentation with corrections

# Supplemental Information
* [NextAuth sign-in page errors](https://next-auth.js.org/configuration/pages#sign-in-page)
* There is an edge case where if a user signs in with a provider then logs out and signs in with a different provider with a different email, a new user is created and the two accounts are unable to be linked. This is mitigated if a user signs in with their initial account and connects any additional accounts while logged in before they try to sign in using a different provider with a different email.
* Try connecting multiple google accounts, it works!

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

The issue points to the app’s sign-in page and the NextAuth sign-in callback logic. First read that authentication entry point to see how providers are listed and callback decisions are made, then locate where sign-in errors are shown to users. Add/adjust logic to filter out acmutd.co providers and block acmutd.co Google logins with clear messaging, then verify with sign-in attempts using personal vs acmutd.co accounts and update the authentication docs to describe the new flow.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
next.js, typescript
Lĩnh vực
authentication
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.