File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
todo0/src/server/controllers
wiki0/src/server/controllers Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -74,8 +74,13 @@ const verify = async (
74
74
}
75
75
76
76
// Ensure the profile response has the correct fields present to update or create a new user
77
- if ( ! profile . displayName || ! profile . emails ) {
78
- return done ( new Error ( `Invalid profile response: ${ JSON . stringify ( profile ) } ` ) ) ;
77
+ if ( ! profile . emails ) {
78
+ done ( new Error ( `Invalid profile response: ${ JSON . stringify ( profile ) } ` ) ) ;
79
+ return ;
80
+ }
81
+
82
+ if ( ! profile . displayName ) {
83
+ profile . displayName = profile . emails [ 0 ] ?. value || ""
79
84
}
80
85
81
86
try {
Original file line number Diff line number Diff line change @@ -73,11 +73,16 @@ const verify = async (
73
73
74
74
if ( ! user ) {
75
75
// Ensure the profile response has the correct fields present to update or create a new user
76
- if ( ! profile . displayName || ! profile . emails ) {
76
+
77
+ if ( ! profile . emails ) {
77
78
done ( new Error ( `Invalid profile response: ${ JSON . stringify ( profile ) } ` ) ) ;
78
79
return ;
79
80
}
80
81
82
+ if ( ! profile . displayName ) {
83
+ profile . displayName = profile . emails [ 0 ] ?. value || ""
84
+ }
85
+
81
86
user = await prisma . user . findFirst ( {
82
87
where : {
83
88
orgId : org . id ,
You can’t perform that action at this time.
0 commit comments