summaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2023-02-23 10:52:40 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2023-02-23 10:52:40 +0700
commit0de0fda98dc35bd6503f1a45a52878b154a94c75 (patch)
tree3e6a693b20f58c4f234a7d5e124f2b21751ca37a /src/pages
parenta553af3576985e6d14cf59177a6cca9fa108c0bb (diff)
fox
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/activate.jsx5
-rw-r--r--src/pages/api/activation-request.js27
-rw-r--r--src/pages/my/profile.jsx4
3 files changed, 36 insertions, 0 deletions
diff --git a/src/pages/activate.jsx b/src/pages/activate.jsx
new file mode 100644
index 00000000..a8106509
--- /dev/null
+++ b/src/pages/activate.jsx
@@ -0,0 +1,5 @@
+import ActivateComponent from '@/lib/auth/components/Activate'
+
+export default function Activate() {
+ return <ActivateComponent />
+}
diff --git a/src/pages/api/activation-request.js b/src/pages/api/activation-request.js
new file mode 100644
index 00000000..7fae2fd1
--- /dev/null
+++ b/src/pages/api/activation-request.js
@@ -0,0 +1,27 @@
+import odooApi from '@/core/api/odooApi'
+import mailer from '@/core/utils/mailer'
+
+export default async function handler(req, res) {
+ try {
+ const { email } = req.body
+ let result = await odooApi('POST', '/api/v1/user/activation-request', { email })
+ if (result.activationRequest) {
+ mailer.sendMail({
+ from: 'sales@indoteknik.com',
+ to: result.user.email,
+ subject: 'Permintaan Aktivasi Akun Indoteknik',
+ html: `
+ <h1>Permintaan Aktivasi Akun Indoteknik</h1>
+ <br>
+ <p>Aktivasi akun anda melalui link berikut: <a href="${process.env.SELF_HOST}/activate?token=${result.token}">Aktivasi Akun</a></p>
+ `
+ })
+ }
+ delete result.user
+ delete result.token
+ res.status(200).json(result)
+ } catch (error) {
+ console.log(error)
+ res.status(400).json({ error: error.message })
+ }
+}
diff --git a/src/pages/my/profile.jsx b/src/pages/my/profile.jsx
index f69d4303..f8d4c3de 100644
--- a/src/pages/my/profile.jsx
+++ b/src/pages/my/profile.jsx
@@ -1,10 +1,14 @@
+import Divider from '@/core/components/elements/Divider/Divider'
import AppLayout from '@/core/components/layouts/AppLayout'
+import CompanyProfile from '@/lib/auth/components/CompanyProfile'
import PersonalProfile from '@/lib/auth/components/PersonalProfile'
export default function Profile() {
return (
<AppLayout title='Akun Saya'>
<PersonalProfile />
+ <Divider />
+ <CompanyProfile />
</AppLayout>
)
}