Skip to content

Commit

Permalink
fix: make phone optional during enrollment (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
j-chmielewski authored Mar 21, 2024
1 parent d3e4651 commit 7ef47a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ export const DataVerificationStep = () => {
() =>
z.object({
phone: z
.string()
.trim()
.nonempty(LL.form.errors.required())
.regex(phonePattern, LL.form.errors.invalid()),
.union([
z.string().length(0),
z.string().trim().regex(phonePattern, LL.form.errors.invalid()),
])
.optional()
.transform((e) => (e === '' ? undefined : e)),
}),
[LL.form.errors],
);
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/enrollment/steps/DeviceStep/DeviceStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const DeviceStep = () => {
});

useEffect(() => {
if (userPhone && userPassword) {
if (userPassword) {
const sub = nextSubject.subscribe(() => {
if ((deviceState && deviceState.device && deviceState.configs) || vpnOptional) {
setStore({
Expand Down
2 changes: 1 addition & 1 deletion web/src/shared/hooks/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type EnrollmentStartResponse = {
};

export type ActivateUserRequest = {
phone_number: string;
phone_number?: string;
password: string;
};

Expand Down

0 comments on commit 7ef47a2

Please sign in to comment.