making changes to user model to know what's optional and what's not to protect against google
This commit is contained in:
@@ -93,18 +93,17 @@ async function login(req: Request, res: Response) {
|
||||
);
|
||||
|
||||
// create initial user model object
|
||||
|
||||
const newUser = new User(
|
||||
googleUserId,
|
||||
userInfo.email,
|
||||
userInfo.verifiedEmail,
|
||||
userInfo.name,
|
||||
userInfo.given_name,
|
||||
userInfo.family_name,
|
||||
userInfo.picture,
|
||||
userInfo.locale,
|
||||
new Date(),
|
||||
UserStatus.ONLINE,
|
||||
new Date()
|
||||
userInfo.picture,
|
||||
userInfo.verifiedEmail,
|
||||
userInfo.locale
|
||||
);
|
||||
|
||||
// create user if not exists
|
||||
|
||||
@@ -4,17 +4,18 @@ export class User {
|
||||
constructor(
|
||||
public googleId: string, // our Google id that every google user has unique that we are going to use for now
|
||||
public email: string,
|
||||
public verifiedEmail: boolean,
|
||||
|
||||
public name: string,
|
||||
public givenName: string,
|
||||
public familyName: string,
|
||||
public picture: string,
|
||||
public locale: string,
|
||||
public createdDate: Date,
|
||||
public picture?: string,
|
||||
public verifiedEmail: boolean = false,
|
||||
|
||||
public locale?: string,
|
||||
|
||||
// additional properties specific to our users collection
|
||||
|
||||
public createdDate: Date,
|
||||
public status: UserStatus,
|
||||
public status?: UserStatus,
|
||||
public lastUpdatedDate?: Date,
|
||||
public _id?: ObjectId
|
||||
) {}
|
||||
|
||||
@@ -7,6 +7,8 @@ export function useAuthCheck(jwtToken?: string) {
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
enabled: jwtToken ? true : false,
|
||||
|
||||
refetchInterval: 10000,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user