All files / realm/blong-access/gateway/access accessProfilePasswordChange.ts

100% Statements 23/23
100% Branches 2/2
100% Functions 1/1
100% Lines 23/23

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 241x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x  
import {validation} from '@feasibleone/blong';
 
/**
 * `access.profile.password.change` — change the caller's own password. The
 * actor id comes from the token's `sub` claim (never from params), so this is
 * a self-service method: bearer-authenticated but no RBAC action needed.
 */
export default validation(
    async ({lib: {type}}) =>
        function accessProfilePasswordChange() {
            return {
                skipAuthorize: true,
                params: type.Object({
                    currentPassword: type.String(),
                    newPassword: type.String(),
                }),
                result: type.Object(
                    {success: type.Boolean()},
                    {additionalProperties: true},
                ),
            };
        },
);