diff --git a/Modules/Client/Http/Controllers/Api/AuthController.php b/Modules/Client/Http/Controllers/Api/AuthController.php index b0596e59..977302d6 100755 --- a/Modules/Client/Http/Controllers/Api/AuthController.php +++ b/Modules/Client/Http/Controllers/Api/AuthController.php @@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\Response; class AuthController extends Controller { - public function requestOtp(Request $request) + public function login(Request $request) { $request->validate([ 'phoneOrEmail' => 'required' diff --git a/frontend/client-portal/src/pages/auth/OtpValidation.tsx b/frontend/client-portal/src/pages/auth/OtpValidation.tsx deleted file mode 100755 index cf427ea9..00000000 --- a/frontend/client-portal/src/pages/auth/OtpValidation.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import { capitalCase } from 'change-case'; -// @mui -import { styled } from '@mui/material/styles'; -import { - Box, - Button, - Card, - Divider, - Grid, - Link, - Stack, - IconButton, - Typography, -} from '@mui/material'; -// hooks -import useAuth from '../../hooks/useAuth'; -// components -import Page from '../../components/Page'; -import Image from '../../components/Image'; -import Iconify from '../../components/Iconify'; -// sections -import { VerifyCodeForm } from '../../sections/auth/verify-code'; -// react -import { useState } from 'react'; -import { useNavigate } from 'react-router-dom'; - -// ---------------------------------------------------------------------- - -const RootStyle = styled('div')(({ theme }) => ({ - [theme.breakpoints.up('md')]: { - display: 'flex', - }, - minHeight: '100vh', - flexDirection: 'column', - justifyContent: 'center', - alignItems: 'center', -})); - -const ContentStyle = styled(Card)(({ theme }) => ({ - [theme.breakpoints.up('md')]: { - maxHeight: '600px', - maxWidth: '1000px', - }, -})); - -// ---------------------------------------------------------------------- - -export default function OtpValidation() { - const { method } = useAuth(); - const navigate = useNavigate(); - const formPhone = false; - - const handlerChange = (event: any, setForm: boolean) => { - event.preventDefault(); - // setFormPhone(setForm); - navigate('/auth/login', { state: { setForm: setForm } }); - }; - - const otpRequestHandler = (event: any) => { - event.preventDefault(); - alert('otp sudah dikirim ulang!'); - }; - - return ( - - - - - - login - - - - - - - - Verifikasi OTP - - - {/* */} - - Masukkan kode OTP anda disini - - {/* */} - - - - - - - Tidak Mendapatkan Kode? - - otpRequestHandler(event)} - > - Kirim Ulang Kode OTP - - - - Atau - - - {formPhone === false ? ( - handlerChange(event, true)} - > - Masuk menggunakan nomor handphone - - ) : ( - handlerChange(event, false)} - > - Masuk menggunakan email - - )} - - - - - - - ); -} diff --git a/frontend/client-portal/src/pages/auth/VerifyCode.tsx b/frontend/client-portal/src/pages/auth/VerifyCode.tsx new file mode 100755 index 00000000..4aaf2cbd --- /dev/null +++ b/frontend/client-portal/src/pages/auth/VerifyCode.tsx @@ -0,0 +1,107 @@ +import { useLocation, useNavigate } from 'react-router-dom'; +// @mui +import { styled } from '@mui/material/styles'; +import { Box, Card, Divider, IconButton, Grid, Link, Stack, Typography } from '@mui/material'; +// components +import Page from '../../components/Page'; +import Image from '../../components/Image'; +import Iconify from '../../components/Iconify'; +// sections +import { VerifyCodeForm } from '../../sections/auth/verify-code'; +import { useEffect } from 'react'; + +// ---------------------------------------------------------------------- + +const RootStyle = styled('div')(({ theme }) => ({ + [theme.breakpoints.up('md')]: { + display: 'flex', + }, + minHeight: '100vh', + flexDirection: 'column', + justifyContent: 'center', + alignItems: 'center', +})); + +const ContentStyle = styled(Card)(({ theme }) => ({ + [theme.breakpoints.up('md')]: { + maxHeight: '600px', + maxWidth: '1000px', + }, +})); +// ---------------------------------------------------------------------- + +export default function VerifyCode() { + const { state } = useLocation(); + const navigate = useNavigate(); + + useEffect(() => { + if (state === null) { + navigate('/auth/login'); + } + }, [state, navigate]); + + return ( + + + + + + login + + + + + + navigate('/auth/login', { state: { formPhone: state.formPhone } }) + } + > + + + + Verifikasi OTP + + + + + Masukkan kode OTP anda disini + + + + + + + Tidak mendapatkan kode? + Kirim Ulang Kode OTP + + Atau + + + {state.formPhone ? ( + navigate('/auth/login', { state: { formPhone: false } })} + > + Masuk menggunakan email + + ) : ( + navigate('/auth/login', { state: { formPhone: true } })} + > + Masuk menggunakan nomor handphone + + )} + + + + + + + ); +}