Skip to content

Commit

Permalink
Merge pull request #140 from ystv/int-177-sign-in-fails-if-your-email…
Browse files Browse the repository at this point in the history
…s-prefix-matches-another-user
  • Loading branch information
archessmn authored Sep 4, 2024
2 parents 1c231bf + f1dff9b commit 9821c15
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/(authenticated)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default async function AuthenticatedLayout({

Sentry.setUser({
id: user.user_id,
username: user.username,
email: user.email,
});

Expand Down
1 change: 0 additions & 1 deletion components/UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function UserProvider(props: {
useEffect(() => {
Sentry.setUser({
id: props.user.user_id,
username: props.user.username,
email: props.user.email,
});
}, [props.user]);
Expand Down
1 change: 0 additions & 1 deletion lib/auth/google/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export async function findOrCreateUserFromGoogleToken(rawToken: string) {
first_name: claims.given_name!,
last_name: claims.family_name!,
email: claims.email!,
username: claims.email!.split("@")[0],
avatar: claims.picture,
identities: {
create: {
Expand Down
1 change: 0 additions & 1 deletion lib/auth/slack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export async function findOrCreateUserFromSlackToken(userInfo: SlackTokenJson) {
first_name: userInfo.given_name!,
last_name: userInfo.family_name!,
email: userInfo.email!,
username: userInfo.email!.split("@")[0],
avatar: userInfo.picture!,
identities: {
create: {
Expand Down
11 changes: 11 additions & 0 deletions lib/db/migrations/20240904143009_remove_username/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
Warnings:
- You are about to drop the column `username` on the `users` table. All the data in the column will be lost.
*/
-- DropIndex
DROP INDEX "users_username_key";

-- AlterTable
ALTER TABLE "users" DROP COLUMN "username";
1 change: 0 additions & 1 deletion lib/db/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ model Role {
/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model User {
user_id Int @id @default(autoincrement())
username String @unique
email String @unique
first_name String
last_name String
Expand Down
1 change: 0 additions & 1 deletion lib/db/types/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const jsonSchema: z.ZodSchema<Json> = z.lazy(() => z.union([literalSchema, z.arr

export const _UserModel = z.object({
user_id: z.number().int(),
username: z.string(),
email: z.string(),
first_name: z.string(),
last_name: z.string(),
Expand Down

0 comments on commit 9821c15

Please sign in to comment.