mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
[CORL-476] Add badges to user from SSO token (#2470)
* fix: bug in lookup not checking object properly before accessing * fix: Recursive types not handling optional arrays * add user badges component * create user badges from sso token * update badges type * revert src/core/client/embed/index.html * remove duplicated line * add user badges component * create user badges from sso token * revert src/core/client/embed/index.html * remove duplicated line * fix types * fix tests and snaps * add user badges to user drawer * update snaps * update readme * [CORL-476] add user role from SSO token (#2475) * add role from token * use joi to validate role values Co-Authored-By: Wyatt Johnson <wyattjoh@gmail.com> * simplify sso.role validation * add test for invalid role in sso token
This commit is contained in:
co-authored by
Wyatt Johnson
parent
add5224338
commit
7809cd3d68
@@ -292,6 +292,12 @@ export interface User extends TenantResource {
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
/**
|
||||
*
|
||||
* badges are user display badges
|
||||
*/
|
||||
badges?: string[];
|
||||
|
||||
/**
|
||||
* emailVerificationID is used to store state regarding the verification state
|
||||
* of an email address to prevent replay attacks.
|
||||
@@ -668,6 +674,8 @@ export async function updateUserPassword(
|
||||
export interface UpdateUserInput {
|
||||
email?: string;
|
||||
username?: string;
|
||||
badges?: string[];
|
||||
role?: GQLUSER_ROLE;
|
||||
}
|
||||
|
||||
export async function updateUserFromSSO(
|
||||
@@ -677,7 +685,7 @@ export async function updateUserFromSSO(
|
||||
update: UpdateUserInput,
|
||||
lastIssuedAt: Date
|
||||
) {
|
||||
// Update the user with the new password.
|
||||
// Update the user with the new properties.
|
||||
const result = await collection(mongo).findOneAndUpdate(
|
||||
{
|
||||
tenantID,
|
||||
|
||||
Reference in New Issue
Block a user