-
Notifications
You must be signed in to change notification settings - Fork 0
feat: reset password pages #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ruilopesm
wants to merge
8
commits into
main
Choose a base branch
from
rl/reset-password
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4ea23a3
feat: reset password pages
ruilopesm ece0a39
Update assets/vue/components/forgot-password/ForgotPasswordForm.vue
ruilopesm 3608888
chore: apply suggestions
ruilopesm 11ec8b0
Merge branch 'main' into rl/reset-password
ruilopesm 0a30fcb
refactor: useLiveForm new API
ruilopesm 53d6424
Merge branch 'main' into rl/reset-password
ruilopesm 13fcea1
Merge branch 'main' into rl/reset-password
ruilopesm d653d9e
chore: apply suggestions
ruilopesm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <script setup lang="ts"> | ||
| import { GalleryVerticalEnd } from "lucide-vue-next"; | ||
| import { Link } from "live_vue"; | ||
| import ForgotPasswordForm from "./components/ForgotPasswordForm.vue"; | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="min-h-svh flex items-center justify-center p-6"> | ||
| <div class="w-full max-w-md space-y-8"> | ||
| <div class="flex justify-center"> | ||
| <Link navigate="/" class="flex items-center gap-2 font-medium"> | ||
| <div | ||
| class="flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground" | ||
| > | ||
| <GalleryVerticalEnd class="size-5" /> | ||
| </div> | ||
| Katana | ||
| </Link> | ||
| </div> | ||
| <ForgotPasswordForm /> | ||
| </div> | ||
| </div> | ||
| </template> |
49 changes: 49 additions & 0 deletions
49
lib/katana_web/live/forgot-password/components/ForgotPasswordForm.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <script setup lang="ts"> | ||
| import { Ref, ref } from "vue"; | ||
| import { Button } from "@/components/ui/button"; | ||
| import { Input } from "@/components/ui/input"; | ||
| import { Label } from "@/components/ui/label"; | ||
| import { Link } from "live_vue"; | ||
|
|
||
| const form: Ref<{ email: string }> = ref({ | ||
| email: "", | ||
| }); | ||
| </script> | ||
|
|
||
| <template> | ||
| <form class="flex flex-col gap-6"> | ||
| <div class="flex flex-col items-center gap-2 text-center"> | ||
| <h1 class="text-2xl font-bold">Esqueceu-se da sua palavra-passe?</h1> | ||
| <p class="text-muted-foreground text-sm"> | ||
| Introduza o endereço de email associado à sua conta e enviaremos um | ||
| link para redefinir a sua palavra-passe | ||
| </p> | ||
| </div> | ||
| <div class="grid gap-6"> | ||
| <div class="grid gap-3"> | ||
| <Label for="email">Email</Label> | ||
| <Input | ||
| id="email" | ||
| type="email" | ||
| placeholder="mail@coderdojobraga.org" | ||
| v-model="form.email" | ||
| required | ||
| /> | ||
| </div> | ||
| <Button | ||
| type="button" | ||
| @click="$live.pushEvent('send_email', { user: { email: form.email } })" | ||
| :disabled="!form.email" | ||
| class="w-full" | ||
| > | ||
| Enviar link de redefinição | ||
| </Button> | ||
| </div> | ||
| <div class="text-center text-sm"> | ||
| Lembra-se da sua palavra-passe? | ||
| <Link navigate="/users/log_in" class="underline underline-offset-4"> | ||
| Iniciar sessão | ||
| </Link> | ||
| </div> | ||
| </form> | ||
| </template> |
32 changes: 32 additions & 0 deletions
32
lib/katana_web/live/forgot-password/forgot_password_live.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| defmodule KatanaWeb.ForgotPasswordLive do | ||
| use KatanaWeb, {:live_view, :root} | ||
|
|
||
| alias Katana.Accounts | ||
|
|
||
| def render(assigns) do | ||
| ~H""" | ||
| <.vue v-component="ForgotPassword" v-socket={@socket} /> | ||
| """ | ||
| end | ||
|
|
||
| def mount(_params, _session, socket) do | ||
| {:ok, assign(socket, form: to_form(%{}, as: "user"))} | ||
| end | ||
|
|
||
| def handle_event("send_email", %{"user" => %{"email" => email}}, socket) do | ||
| if user = Accounts.get_user_by_email(email) do | ||
| Accounts.deliver_reset_password_instructions( | ||
| user, | ||
| &url(~p"/reset_password/#{&1}") | ||
| ) | ||
| end | ||
|
|
||
| {:noreply, | ||
| socket | ||
| |> put_flash( | ||
| :info, | ||
| "If your email is in our system, you will receive instructions to reset your password shortly." | ||
| ) | ||
| |> redirect(to: ~p"/")} | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <script setup lang="ts"> | ||
| import { GalleryVerticalEnd } from "lucide-vue-next"; | ||
| import { Form, Link } from "live_vue"; | ||
| import ResetPasswordForm from "./components/ResetPasswordForm.vue"; | ||
|
|
||
| const props = defineProps<{ | ||
| form: Form<ResetPasswordFields> | ||
| }>(); | ||
| </script> | ||
|
|
||
| <template> | ||
| <div class="min-h-svh flex items-center justify-center p-6"> | ||
| <div class="w-full max-w-md space-y-8"> | ||
| <div class="flex justify-center"> | ||
| <Link navigate="/" class="flex items-center gap-2 font-medium"> | ||
| <div | ||
| class="flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground" | ||
| > | ||
| <GalleryVerticalEnd class="size-5" /> | ||
| </div> | ||
| Katana | ||
| </Link> | ||
| </div> | ||
| <ResetPasswordForm :form="props.form" /> | ||
| </div> | ||
| </div> | ||
| </template> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.