X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=cmd%2Fweb%2Fjs%2Fmain.jsx;h=a64b34248bd3dacb97a2de6e32fad5907ed86bc6;hb=a6820180928670b0642fa6a28ac221ce158230bb;hp=827b83da680486ef531dde9a90713f2057042055;hpb=989fb5c7dbba174f54f3ae69df788d6685fff46b;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/cmd/web/js/main.jsx b/cmd/web/js/main.jsx index 827b83d..a64b342 100644 --- a/cmd/web/js/main.jsx +++ b/cmd/web/js/main.jsx @@ -1,21 +1,16 @@ import SignupForm from './signup.js'; import SigninForm from './signin.js'; +import PasswordResetForm from './password_reset.js'; +import ChangePasswordForm from './change_password.js'; import OtpEnrollForm from './otp.js'; import PoloniexController from './poloniex.js'; +import UserAccount from './account.js'; +import AdminDashboard from './admin.js'; import App from './app.js'; import Api from './api.js'; import cookies from './cookies.js'; import React from 'react'; - -class Logo extends React.Component { - render() { - return
- -
; - } -} +import qs from 'qs'; App.page('/signup', false, function(context) { if (App.isUserSignedIn()) { @@ -24,7 +19,6 @@ App.page('/signup', false, function(context) { } App.mount(
-
); }); @@ -36,24 +30,96 @@ App.page('/signin', false, function(context) { } App.mount(
-
); }); +App.page('/reset-password', false, function(context) { + if (App.isUserSignedIn()) { + App.go('/me'); + return; + } + + App.mount(
+ +
); +}); + +App.page('/change-password', false, function(context) { + if (App.isUserSignedIn()) { + App.go('/me'); + return; + } + + var token = qs.parse(context.querystring).token; + + if (token === undefined) { + App.go('/'); + return; + } + + App.mount(
+ +
); +}); + +App.page('/confirm', false, function(context) { + var token = qs.parse(context.querystring).token; + + if (token === undefined) { + App.go('/'); + return; + } + + Api.Call( + 'CONFIRM_EMAIL', + {'token': token}, + function(err, status, data) { + if (err) { + console.error(err, data); + } + + App.go('/me'); + } + ); +}); + App.page('/signout', true, function(context) { cookies.removeItem('jwt'); + cookies.removeItem('isAdmin'); App.go('/'); }); App.page('/me', true, function(context) { App.mount(
-
); }); +App.page('/account', true, function(context) { + App.mount(
+ +
); +}); + +App.page('/admin', true, function(context) { + App.mount(
+ +
); +}); + +App.page('/not_confirmed', true, function(context) { + App.mount(
+
+
+

An email has now been sent to your email address.

+

{'Please click the \'Confirm your account\' button to validate your email.'}

+
+
+
); +}); + App.page('/otp/setup', true, function(context) { Api.Call('OTP_ENROLL', {}, function(err, status, data) { if (err) { @@ -62,7 +128,6 @@ App.page('/otp/setup', true, function(context) { } App.mount(
-
); @@ -71,7 +136,6 @@ App.page('/otp/setup', true, function(context) { App.page('/otp/validate', true, function(context) { App.mount(
-
); });