Skip to content
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

feat: implement ResetPasswordView #105

Closed
wants to merge 1 commit into from
Closed
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
54 changes: 51 additions & 3 deletions src/views/ResetPasswordView.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,56 @@
<script setup lang="ts"></script>
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import EmailTextbox from '@/components/Controls/Textbox/EmailTextbox.vue'
import PrimaryButton from '@/components/Controls/PrimaryButton.vue'

const emailAddress = ref('')
const router = useRouter()
async function onEmailResetPassword() {
try {
const response = await fetch(`${import.meta.env.VITE_API_BASE_URL}/reset-password/request`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ email: emailAddress.value })
})
if (response.status === 201) {
router.push('/reset-password/after-mail')
} else if (response.status === 400) {
alert('不正なリクエストです メールアドレスの形式を確認してください')
} else {
alert(response.status)
}
} catch (error) {
console.error('Reset Password Error:', error)
alert('Reset Password Error:' + error)
}
}
</script>

<template>
<div>
<h1>Reset Password</h1>
<div
class="flex items-center justify-center bg-background-tertiary px-8 py-6"
style="height: calc(100vh - 56px)"
>
<div class="max-w-3xl space-y-4 rounded-2xl bg-white px-14 py-10">
<div class="fontstyle-ui-title text-left">パスワードの再設定</div>
<div class="flex divide-x divide-border-secondary">
<div class="flex-1 pr-4">
<div class="fontstyle-ui-body space-y-2 p-2 text-left text-text-secondary">
<p><span class="text-nowrap">再設定用のリンクをメールで送信します。</span></p>
<p>60分以内に、メールに記載されたリンクから再設定を行ってください。</p>
</div>
</div>
<div class="flex-1 pl-4">
<div class="space-y-3 p-2.5">
<EmailTextbox id="email" v-model="emailAddress" placeholder="メールアドレス" />
<PrimaryButton text="送信" class="w-full" @click="onEmailResetPassword" />
</div>
</div>
</div>
</div>
</div>
</template>

Expand Down
Loading