issue-129 tweaks after deploy test

This commit is contained in:
Kurt Hutten
2020-12-05 18:04:11 +11:00
parent fc4906757a
commit 77a50b4f17
6 changed files with 28 additions and 16 deletions

View File

@@ -33,7 +33,6 @@ const Routes = () => {
return (
<Router>
<Route path="/account-recovery/update-password" page={UpdatePasswordPage} name="updatePassword" />
{/* <Route path="/account-recovery/update-password/{recoveryToken}" page={UpdatePasswordPage} name="updatePassword" /> */}
<Route path="/account-recovery" page={AccountRecoveryPage} name="accountRecovery" />
<Route path="/" page={PartsPage} name="home" />
<Route notfound page={NotFoundPage} />

View File

@@ -10,7 +10,7 @@ const InputText = ({ value, isEditable, onChange, className }) => {
className
)}
>
<div className="absolute inset-0 mb-2 rounded bg-gray-200 shadow-inners" />
<div className="absolute inset-0 mb-2 rounded bg-gray-200 shadow-inner" />
<input
className="pl-2 pt-1 text-indigo-800 font-medium mb-px pb-px bg-transparent relative"
onChange={onChange}

View File

@@ -6,10 +6,13 @@ import InputTextForm from 'src/components/InputTextForm'
import OutBound from 'src/components/OutBound'
import { Form, Submit } from '@redwoodjs/forms'
import { useAuth } from '@redwoodjs/auth'
import { useFlash } from '@redwoodjs/web'
import { Link, routes } from '@redwoodjs/router'
import { subscribe } from 'src/helpers/subscribe'
const LoginModal = ({ open, onClose, shouldStartWithSignup = false }) => {
const { logIn, signUp } = useAuth()
const { addMessage } = useFlash()
const [tab, setTab] = useState(shouldStartWithSignup ? 0 : 1)
const onTabChange = (_, newValue) => {
@@ -22,6 +25,9 @@ const LoginModal = ({ open, onClose, shouldStartWithSignup = false }) => {
const onSubmitSignUp = async ({ email, password, name, userName }) => {
try {
setError('')
if (checkBox) {
subscribe({ email, addMessage })
}
await signUp({
email,
password,

View File

@@ -0,0 +1,15 @@
export const subscribe = ({ email, addMessage }) => {
// subscribe to mailchimp newsletter
const path = window.location.hostname + window.location.pathname
try {
fetch(
`https://kurthutten.us10.list-manage.com/subscribe/post-json?u=cbd8888e924bdd99d06c14fa5&amp;id=6a765a8b3d&EMAIL=${email}&FNAME=Kurt&PATHNAME=${path}&c=__jp0`
)
} catch (e) {
setTimeout(() => {
addMessage('Problem subscribing to newsletter', {
classes: 'bg-red-300 text-red-900',
})
}, 1000)
}
}

View File

@@ -103,10 +103,6 @@ const MainLayout = ({ children }) => {
})
})
} else if (key === 'recovery_token') {
// http://localhost:8910/#recovery_token=LwsC-KpgmiDwGo-ZcGH0tA
// https://mandrillapp.com/track/click/31128206/cadhub.xyz?p=eyJzIjoiWFlFbDk5YTVYU0FOSmEtZ3ZtUXlDSW13QURrIiwidiI6MSwicCI6IntcInVcIjozMTEyODIwNixcInZcIjoxLFwidXJsXCI6XCJodHRwczpcXFwvXFxcL2NhZGh1Yi54eXpcXFwvI3JlY292ZXJ5X3Rva2VuPUx3c0MtS3BnbWlEd0dvLVpjR0gwdEFcIixcImlkXCI6XCJjODU1ZWM1MjZiZmQ0Y2JmYmUyNmM4OTk2ZGU4ODczOFwiLFwidXJsX2lkc1wiOltcIjJkMjljMDI0NTY5MzcxODcxMmI0ODA0M2U3MDYyOTA1ZDc1NzVkNjlcIl19In0
// #recovery_token=LwsC-KpgmiDwGo-ZcGH0tA
// navigate(routes.updatePassword({ recoveryToken: token }))
client
.recover(token, true)
.then(() => {

View File

@@ -11,7 +11,7 @@ const UpdatePasswordPage = () => {
const { addMessage } = useFlash()
const { client } = useAuth()
const onSubmit = ({ password, confirm }) => {
if (password !== confirm) {
if (password !== confirm || !password) {
addMessage("Passwords don't match, try again", {
classes: 'bg-red-300 text-red-900',
})
@@ -21,24 +21,20 @@ const UpdatePasswordPage = () => {
.currentUser()
.update({ password })
.then(() => {
addMessage('Email updated', { classes: 'rw-flash-success' })
addMessage('Password updated', { classes: 'rw-flash-success' })
setTimeout(() => {
navigate(routes.home())
}, 500)
})
.catch(() => {
addMessage('Problem updating email', {
addMessage('Problem updating password', {
classes: 'bg-red-300 text-red-900',
})
})
}
return (
<MainLayout>
<Seo
title="Account recovery"
description="Send recovery email"
lang="en-US"
/>
<Seo title="Update Password" description="Update Password" lang="en-US" />
<section className="max-w-md mx-auto mt-20">
<h2 className="text-xl text-indigo-500 pb-4">Reset Password</h2>
@@ -52,7 +48,7 @@ const UpdatePasswordPage = () => {
</span>
<InputTextForm
className="text-xl"
name="email"
name="password"
type="password"
validation={{
required: true,
@@ -63,7 +59,7 @@ const UpdatePasswordPage = () => {
</span>
<InputTextForm
className="text-xl"
name="email"
name="confirm"
type="password"
validation={{
required: true,