Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions src/batch-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,22 +530,44 @@ export class ZimbraBatchClient {
loginNewPassword,
password,
username,
dryRun = false
}: ChangePasswordOptions) =>
this.jsonRequest({
name: 'ChangePassword',
namespace: Namespace.Account,
body: {
account: {
by: 'name',
_content: username
dryRun = false,
authToken,
csrfToken
}: ChangePasswordOptions) => {
if (authToken) {
return this.jsonRequest({
name: 'ChangePassword',
namespace: Namespace.Account,
body: {
account: {
by: 'name',
_content: username
},
oldPassword: password,
password: loginNewPassword,
dryRun,
authToken: { _content: authToken },
csrfToken: { _content: csrfToken }
},
oldPassword: password,
password: loginNewPassword,
dryRun
},
singleRequest: true
});
singleRequest: true
});
} else {
return this.jsonRequest({
name: 'ChangePassword',
namespace: Namespace.Account,
body: {
account: {
by: 'name',
_content: username
},
oldPassword: password,
password: loginNewPassword,
dryRun
},
singleRequest: true
});
}
};

public checkCalendar = ({ id, value }: FolderActionCheckCalendarInput) =>
this.action(ActionType.folder, {
Expand Down
2 changes: 2 additions & 0 deletions src/batch-client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ export interface ShareInfoOptions {
}

export interface ChangePasswordOptions {
authToken: string;
csrfToken: string;
dryRun: boolean;
loginNewPassword: string;
password: string;
Expand Down
10 changes: 10 additions & 0 deletions src/schema/generated-schema-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,11 @@ export type AccountInfoAttrs = {
zimbraExternalSharingEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureAdminMailEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureAdminPreferencesEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureAdvancedChatEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureAllowUsernameInPassword?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureAntispamEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureAppSpecificPasswordsEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureBasicOneToOneChatEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureBriefcasesEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureCalendarEnabled?: Maybe<Scalars['Boolean']['output']>;
zimbraFeatureChangePasswordEnabled?: Maybe<Scalars['Boolean']['output']>;
Expand Down Expand Up @@ -384,6 +386,7 @@ export type AuthResponse = {
authToken?: Maybe<Array<Maybe<AuthToken>>>;
csrfToken?: Maybe<CsrfToken>;
lifetime?: Maybe<Scalars['Float']['output']>;
resetPassword?: Maybe<ResetPassword>;
session?: Maybe<Session>;
skin?: Maybe<Array<Maybe<Skin>>>;
trustedDevicesEnabled?: Maybe<TrustedDevicesEnabled>;
Expand Down Expand Up @@ -2793,6 +2796,8 @@ export type MutationChangeFolderColorArgs = {


export type MutationChangePasswordArgs = {
authToken?: InputMaybe<Scalars['String']['input']>;
csrfToken?: InputMaybe<Scalars['String']['input']>;
dryRun?: InputMaybe<Scalars['Boolean']['input']>;
loginNewPassword: Scalars['String']['input'];
password: Scalars['String']['input'];
Expand Down Expand Up @@ -4036,6 +4041,11 @@ export type ReplyActionInput = {
index?: InputMaybe<Scalars['Int']['input']>;
};

export type ResetPassword = {
__typename?: 'ResetPassword';
_content?: Maybe<Scalars['Boolean']['output']>;
};

export type ResetPasswordResponse = {
__typename?: 'ResetPasswordResponse';
attrs?: Maybe<ResetPasswordResponseAttributes>;
Expand Down
9 changes: 9 additions & 0 deletions src/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ type AuthResponse {
session: Session
skin: [Skin]
csrfToken: CsrfToken
resetPassword: ResetPassword
}

type ScratchCodeType {
Expand Down Expand Up @@ -382,6 +383,10 @@ type TrustedDevicesEnabled {
_content: Boolean
}

type ResetPassword {
_content: Boolean
}

type Session {
id: ID
_content: String
Expand Down Expand Up @@ -1529,6 +1534,8 @@ type AccountInfoAttrs {
zimbraFeatureGroupCalendarEnabled: Boolean
zimbraFeatureDistributionListExpandMembersEnabled: Boolean
zimbraFeatureDistributionListFolderEnabled: Boolean
zimbraFeatureBasicOneToOneChatEnabled: Boolean
zimbraFeatureAdvancedChatEnabled: Boolean
}

type AccountCos {
Expand Down Expand Up @@ -3675,6 +3682,8 @@ type Mutation {
loginNewPassword: String!
password: String!
username: String!
authToken: String
csrfToken: String
): AuthResponse
modifyProfileImage(
content: String
Expand Down