From 636b0323075225c584b62719ed51e75521bb7ffb Mon Sep 17 00:00:00 2001
From: aura <nw@moneybot.cc>
Date: Tue, 17 Feb 2026 22:39:42 +0100
Subject: push source

---
 moneyjsx/src/login.tsx | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 moneyjsx/src/login.tsx

(limited to 'moneyjsx/src/login.tsx')

diff --git a/moneyjsx/src/login.tsx b/moneyjsx/src/login.tsx
new file mode 100644
index 0000000..0be6acc
--- /dev/null
+++ b/moneyjsx/src/login.tsx
@@ -0,0 +1,29 @@
+import $ from 'jquery';
+import * as JSX from './jsx';
+import * as user from './user';
+import { GroupBox, Page } from './components';
+
+export default function Login() {
+  if( user.is_loggedin )
+    return JSX.navigateParams( "/", {} );
+
+  const url = new URL( window.location.href );
+  const code = url.searchParams.get( "token" );
+  let msg = "You should be redirected shortly...";
+  if( !code ) {
+    msg = "The link you followed is invalid.";
+  }
+  else {
+    user.onLogin( code ).then( () => {
+      JSX.navigateParams( '/terminal', {} );
+    } ).catch( ( e: any ) => {
+      $( "#login-msg" ).text( e.message );
+    } );
+  }
+
+  return <Page>
+    <GroupBox title="Login">
+      <span id="login-msg">{ msg }</span>
+    </GroupBox>
+  </Page>
+}
-- 
cgit v1.2.3

