From 01ebe2c0b8830cc83157c71b03bb941f9ef58ca5 Mon Sep 17 00:00:00 2001 From: mi1468 Date: Sat, 17 May 2025 15:59:45 +0330 Subject: [PATCH] added sms verification --- xroom-dashboard/src/components/Header.vue | 2 +- xroom-dashboard/src/pages/ResetPassword.vue | 2 +- xroom-dashboard/src/pages/SignupPage.vue | 5 + xroom-dashboard/src/pages/SmsVerification.vue | 124 +++++++++++++----- xroom-dashboard/src/router/index.js | 13 +- 5 files changed, 105 insertions(+), 41 deletions(-) diff --git a/xroom-dashboard/src/components/Header.vue b/xroom-dashboard/src/components/Header.vue index 1b795df..0d8de80 100644 --- a/xroom-dashboard/src/components/Header.vue +++ b/xroom-dashboard/src/components/Header.vue @@ -81,7 +81,7 @@ export default { logout() { localStorage.removeItem('user'); localStorage.removeItem('token'); - window.location.href = '/login'; + window.location.href = '/'; }, closeDropdown(event) { if (!this.$el.contains(event.target)) { diff --git a/xroom-dashboard/src/pages/ResetPassword.vue b/xroom-dashboard/src/pages/ResetPassword.vue index 2e1df2a..e4eb08b 100644 --- a/xroom-dashboard/src/pages/ResetPassword.vue +++ b/xroom-dashboard/src/pages/ResetPassword.vue @@ -102,7 +102,7 @@ export default { }); if (response.data.success) { alert('رمز عبور با موفقیت بازنشانی شد.'); - this.$router.push('/login'); + this.$router.push('/'); } } catch (error) { console.error('Error resetting password:', error); diff --git a/xroom-dashboard/src/pages/SignupPage.vue b/xroom-dashboard/src/pages/SignupPage.vue index 4d99e2f..6140bc4 100644 --- a/xroom-dashboard/src/pages/SignupPage.vue +++ b/xroom-dashboard/src/pages/SignupPage.vue @@ -79,6 +79,11 @@ export default { try { const response = await axios.post('http://194.62.43.230:8000/signup', signupData); console.log('Signup success:', response.data); + const token = response.data.token; + + + localStorage.setItem('token', token); + // Redirect to login page upon successful signup this.$router.push('/'); } catch (error) { diff --git a/xroom-dashboard/src/pages/SmsVerification.vue b/xroom-dashboard/src/pages/SmsVerification.vue index a92a25e..2ad0410 100644 --- a/xroom-dashboard/src/pages/SmsVerification.vue +++ b/xroom-dashboard/src/pages/SmsVerification.vue @@ -10,9 +10,21 @@ پیامکی شامل کد تایید به موبایل شما ارسال شده است. - + +