diff --git a/assets/js/app.js b/assets/js/app.js
index a964a90..5fc04c8 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -14,15 +14,17 @@ import "../css/app.css"
// import {Socket} from "phoenix"
// import socket from "./socket"
//
-import "phoenix_html"
-import {Socket} from "phoenix"
-import topbar from "topbar"
-import {LiveSocket} from "phoenix_live_view"
+import "phoenix_html";
+import {Socket} from "phoenix";
+import topbar from "topbar";
+import {LiveSocket} from "phoenix_live_view";
import SplashPage from './pages/SplashPage';
-import JustPage from './pages/JustPage'
-import ForPage from './pages/ForPage'
-import YouPage from './pages/YouPage'
+import JustPage from './pages/JustPage';
+import ForPage from './pages/ForPage';
+import YouPage from './pages/YouPage';
+import AuthPage from './pages/AuthPage';
+import RevealPage from './pages/RevealPage';
let csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content")
let liveSocket = new LiveSocket("/live", Socket, {params: {_csrf_token: csrfToken}})
@@ -42,5 +44,5 @@ liveSocket.connect()
window.liveSocket = liveSocket
window.Components = {
- SplashPage, JustPage, ForPage, YouPage
+ SplashPage, JustPage, ForPage, YouPage, AuthPage, RevealPage
}
diff --git a/assets/js/pages/AuthPage.tsx b/assets/js/pages/AuthPage.tsx
index 97013f8..4215761 100644
--- a/assets/js/pages/AuthPage.tsx
+++ b/assets/js/pages/AuthPage.tsx
@@ -1,16 +1,54 @@
-// import HexMix from "../utils/hexmix";
-// const fragmentData = window.location.hash.split('.');
-// if (fragmentData.length <= 0) {
-// alert("No key found in fragment URI");
-// return;
-// }
-// const key = HexMix.hexToUint8(fragmentData[0]);
-// const iv = HexMix.hexToUint8(fragmentData[1]);
+import { Button, CenteredContainer, GlobalStyle, Header2, Header3, Input, Label, Spacer, TextAlignWrapper } from "@intended/intended-ui";
+import React, { useEffect } from "react";
-// const importedKey = await window.crypto.subtle.importKey(
-// 'raw',
-// key,
-// 'AES-GCM',
-// true,
-// ['encrypt', 'decrypt']
-// );
\ No newline at end of file
+type AuthPageProps = {
+ csrf: string,
+ service: string,
+ recipient: string
+}
+
+const AuthPage = (props: AuthPageProps) => {
+ const { service, recipient } = props;
+ // const [recipientInput, setRecipientInput] = useState("");
+ // const [serviceSelect, setServiceSelect] = useState("github");
+
+ // useEffect(() => {
+
+ // }, [])
+
+ return (
+
+
+
+
+ Someone sent you a secret
+
+ Please verify your identity to reveal this message.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default AuthPage;
diff --git a/assets/js/pages/ForPage.tsx b/assets/js/pages/ForPage.tsx
index 4e1e4e2..852cee7 100644
--- a/assets/js/pages/ForPage.tsx
+++ b/assets/js/pages/ForPage.tsx
@@ -3,9 +3,13 @@ import React, { useState } from "react";
import { ProgressIndicator, Header2, Button, IconArrow, Label, Input, Select, CenteredContainer, SpaceBetweenContainer, Spacer, TextAlignWrapper, GlobalStyle } from "@intended/intended-ui";
-const ForPage = () => {
+type ForPageProps = {
+ csrf: string
+}
+
+const ForPage = (props: ForPageProps) => {
const [recipientInput, setRecipientInput] = useState("");
- const [serviceSelect, setServiceSelect] = useState("");
+ const [serviceSelect, setServiceSelect] = useState("github");
const handleRecipientInputChange = (
e: React.ChangeEvent
@@ -18,14 +22,14 @@ const ForPage = () => {
};
const postContacts = async () => {
- const fragmentData = window.location.hash.split('.');
- if (fragmentData.length <= 0) {
- alert("No key found in fragment URI");
- return;
- }
+ // const fragmentData = window.location.hash.split('.');
+ // if (fragmentData.length <= 0) {
+ // alert("No key found in fragment URI");
+ // return;
+ // }
const linkId = sessionStorage.getItem("link_id");
- if (linkId == null || linkId == "") {
+ if (!linkId) {
alert("No created link found in storage");
return;
}
@@ -36,10 +40,18 @@ const ForPage = () => {
formData.append("link_id", linkId);
try {
- await fetch(`${window.location.origin}/just/for`, {
+ const results = await fetch(`${window.location.origin}/just/for`, {
+ headers: {
+ "X-CSRF-Token": props.csrf
+ },
body: formData,
method: "POST"
});
+ if (!results.ok) {
+ throw new Error('Network response was not OK');
+ }
+
+ await results.json();
window.location.href = `${window.location.origin}/just/for/you`;
} catch (err: any) {
alert(err.message);
@@ -74,7 +86,9 @@ const ForPage = () => {
id="serviceSelector"
onChange={handleServiceChange}
value={serviceSelect}
- />
+ >
+
+