Skip to content

Commit

Permalink
Fix: Align forgot password screens (#3895)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikehrn authored Jan 24, 2025
1 parent 276c3a7 commit a88e55d
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 32 deletions.
4 changes: 2 additions & 2 deletions packages/frontend-2/components/auth/LoginWithEmailBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
Log in
</FormButton>
<div class="mt-1 text-center text-body-xs text-foreground-3 select-none">
Forgot password?
Forgot your password?
<NuxtLink :to="forgottenPasswordRoute" class="text-foreground">
Recover password
Reset password
</NuxtLink>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
<template>
<form class="mx-auto w-full px-2" @submit="onSubmit">
<h1 class="text-heading-xl text-center inline-block mb-4">Reset your password</h1>
<h1 class="text-heading-xl text-center w-full inline-block mb-4">
Reset your password
</h1>

<div class="flex flex-col space-y-2 text-body-sm">
<div class="mb-4">One step closer to resetting your password</div>
<div class="flex flex-col space-y-4">
<p class="text-center text-body-xs text-foreground mb-2">
Choose a new password for your Speckle account
</p>
<FormTextInput
v-model="password"
type="password"
name="password"
label="Password"
placeholder="New password"
color="foundation"
size="lg"
:rules="passwordRules"
:rules="[isRequired]"
show-label
show-required
/>
<FormTextInput
type="password"
name="password-repeat"
label="Password (confirmation)"
color="foundation"
size="lg"
:rules="passwordRepeatRules"
placeholder="Confirm new password"
show-label
show-required
/>
<AuthPasswordChecks :password="password" />
</div>

<FormButton class="mt-4" submit full-width size="lg" :disabled="loading">
<FormButton class="mt-8" submit full-width size="lg" :disabled="loading">
Reset password
</FormButton>
</form>
</template>
<script setup lang="ts">
import { useForm } from 'vee-validate'
import { usePasswordReset } from '~~/lib/auth/composables/passwordReset'
import { isRequired, isSameAs } from '~~/lib/common/helpers/validation'
import { isRequired } from '~~/lib/common/helpers/validation'
type FormValues = {
password: string
repeatPassword: string
}
const props = defineProps<{
Expand All @@ -50,9 +43,8 @@ const props = defineProps<{
const { handleSubmit } = useForm<FormValues>()
const { finalize } = usePasswordReset()
const passwordRules = [isRequired]
const passwordRepeatRules = [...passwordRules, isSameAs('password')]
const loading = ref(false)
const password = ref('')
const onSubmit = handleSubmit(
async ({ password }) => await finalize(password, props.token)
Expand Down
9 changes: 4 additions & 5 deletions packages/frontend-2/components/auth/PasswordResetPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
<h1 class="text-heading-xl text-center inline-block mb-4 w-full">
Reset your password
</h1>
<div class="flex flex-col space-y-4 text-body-xs">
<div>
Type in the email address you used, so we can verify your account. We will send
you instructions on how to reset your password.
<div class="flex flex-col space-y-4">
<div class="text-body-xs text-foreground text-center mb-2">
Enter your email address and we'll send you the password reset instructions.
</div>
<div>
<FormTextInput
Expand All @@ -20,7 +19,7 @@
</div>
</div>

<div class="flex flex-col gap-y-2 mt-4">
<div class="flex flex-col gap-y-2 mt-8">
<FormButton submit full-width size="lg" :disabled="loading">
Send reset email
</FormButton>
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend-2/components/auth/RegisterPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class="flex gap-1 text-foregound-3 text-body-xs items-center justify-center"
>
<span>Already have an account?</span>
<CommonTextLink :to="loginRoute">Log in</CommonTextLink>
<NuxtLink class="text-foreground" :to="loginRoute">Log in</NuxtLink>
</div>
</template>
<template v-else>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<AuthRegisterTerms v-if="serverInfo.termsOfService" :server-info="serverInfo" />
<div v-if="!inviteEmail" class="mt-2 sm:mt-4 text-center text-body-xs">
<span class="mr-2 text-foreground-3">Already have an account?</span>
<CommonTextLink :to="finalLoginRoute">Log in</CommonTextLink>
<NuxtLink class="text-foreground" :to="finalLoginRoute">Log in</NuxtLink>
</div>
</form>
</template>
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend-2/lib/auth/composables/passwordReset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export function usePasswordReset() {
await requestResetEmail({ email, apiOrigin })
triggerNotification({
type: ToastNotificationType.Info,
title: 'Password reset process initialized',
description: `We've sent you instructions on how to reset your password at ${email}`
title: 'Password reset email sent',
description: `We've sent the password reset instructions to ${email}`
})
} catch (e) {
triggerNotification({
Expand Down
12 changes: 12 additions & 0 deletions packages/frontend-2/lib/common/generated/gql/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3845,6 +3845,7 @@ export type UserEmailMutations = {
delete: User;
requestNewEmailVerification?: Maybe<Scalars['Boolean']['output']>;
setPrimary: User;
verify?: Maybe<Scalars['Boolean']['output']>;
};


Expand All @@ -3867,6 +3868,11 @@ export type UserEmailMutationsSetPrimaryArgs = {
input: SetPrimaryUserEmailInput;
};


export type UserEmailMutationsVerifyArgs = {
input: VerifyUserEmailInput;
};

export type UserGendoAiCredits = {
__typename?: 'UserGendoAICredits';
limit: Scalars['Int']['output'];
Expand Down Expand Up @@ -3947,6 +3953,11 @@ export type UsersRetrievalInput = {
query: Scalars['String']['input'];
};

export type VerifyUserEmailInput = {
code: Scalars['String']['input'];
email: Scalars['String']['input'];
};

export type Version = {
__typename?: 'Version';
authorUser?: Maybe<LimitedUser>;
Expand Down Expand Up @@ -8068,6 +8079,7 @@ export type UserEmailMutationsFieldArgs = {
delete: UserEmailMutationsDeleteArgs,
requestNewEmailVerification: UserEmailMutationsRequestNewEmailVerificationArgs,
setPrimary: UserEmailMutationsSetPrimaryArgs,
verify: UserEmailMutationsVerifyArgs,
}
export type UserGendoAiCreditsFieldArgs = {
limit: {},
Expand Down

0 comments on commit a88e55d

Please sign in to comment.