fix(core): update
This commit is contained in:
parent
13fdbcebdc
commit
02a01ca35c
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@apiclient.xyz/zitadel',
|
||||
version: '1.0.5',
|
||||
version: '1.0.6',
|
||||
description: 'An unofficial client for interacting with Zitadel API.'
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ export interface IZitadelUserData {
|
||||
id: string;
|
||||
lastLogin: Date;
|
||||
username: string;
|
||||
};
|
||||
}
|
||||
|
||||
export class ZitaldelUser {
|
||||
// INSTANCE
|
||||
@ -19,11 +19,49 @@ export class ZitaldelUser {
|
||||
}
|
||||
|
||||
public async addRole(projectRole: ZitadelProjectRole) {
|
||||
this.zitadelclientRef.managementClient.addUserGrant({
|
||||
const response = await this.zitadelclientRef.managementClient.addUserGrant({
|
||||
userId: this.data.id,
|
||||
roleKeys: [projectRole.data.key],
|
||||
projectId: projectRole.data.project.data.id,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* change email address of user,
|
||||
* optionally supply own url for email verification
|
||||
* @param emailAddress
|
||||
* @param verificationUrl
|
||||
*/
|
||||
public async changeEmail(optionsArg: { emailAddress: string; verificationUrl?: string }) {
|
||||
const response = await this.zitadelclientRef.userClient.setEmail({
|
||||
userId: this.data.id,
|
||||
email: optionsArg.emailAddress,
|
||||
...(optionsArg.verificationUrl
|
||||
? {
|
||||
sendCode: {
|
||||
urlTemplate: optionsArg.verificationUrl,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
});
|
||||
}
|
||||
|
||||
public async setPassword(optionsArg: { password: string; changeRequired?: boolean }) {
|
||||
const response = await this.zitadelclientRef.userClient.setPassword({
|
||||
userId: this.data.id,
|
||||
newPassword: {
|
||||
password: optionsArg.password,
|
||||
...(optionsArg.changeRequired ? { changeRequired: optionsArg.changeRequired } : {}),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* triggers a password reset action for the user
|
||||
*/
|
||||
public async resetPassword() {
|
||||
const response = await this.zitadelclientRef.userClient.passwordReset({
|
||||
userId: this.data.id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user