3 Commits

Author SHA1 Message Date
b8063e8692 Auth tweaks
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 26s
2024-10-09 20:44:12 -04:00
738260f7de Watermark 2024-10-09 20:37:27 -04:00
82313bef46 Simplify PDF embed 2024-10-09 20:32:39 -04:00
12 changed files with 49 additions and 89 deletions

View File

@ -111,9 +111,7 @@ ${domain}/reset-password?resetToken=${resetToken}
// the database. Returning anything truthy will automatically log the user
// in. Return `false` otherwise, and in the Reset Password page redirect the
// user to the login page.
handler: (_user) => {
return true
},
handler: (_user) => false,
// If `false` then the new password MUST be different from the current one
allowReusedPassword: true,

View File

@ -15,15 +15,14 @@ const transporter = nodemailer.createTransport({
},
})
export const sendEmail = async ({ to, subject, text, html }: Options) => {
return await transporter.sendMail({
export const sendEmail = async ({ to, subject, text, html }: Options) =>
await transporter.sendMail({
from: `"${process.env.FIRST_NAME} ${process.env.LAST_NAME} (noreply)" <${process.env.GMAIL}>`,
to: Array.isArray(to) ? to : [to],
subject,
text,
html,
})
}
export const censorEmail = (email: string): string => {
const [localPart, domain] = email.split('@')

View File

@ -0,0 +1,19 @@
interface PDFProps {
url: string
form?: boolean
}
const PDF = ({ url, form = false }: PDFProps) => (
<embed
src={url}
title="PDF"
type="application/pdf"
style={{
width: 'calc(100vw - 1rem)',
height: `calc(100vh - ${form ? '8.5rem' : '6rem'})`,
}}
className="rounded-xl"
/>
)
export default PDF

View File

@ -102,7 +102,7 @@ const PortraitForm = ({ portrait }: PortraitFormProps) => {
return (
<div className="mx-auto w-fit space-y-2">
<img
className="aspect-portrait max-w-2xl rounded-xl object-cover"
className="aspect-portrait max-w-80 sm:max-w-sm md:max-w-md lg:max-w-lg xl:max-w-xl 2xl:max-w-2xl rounded-xl object-cover"
src={portrait?.fileId}
alt={`${process.env.FIRST_NAME} Portrait`}
/>

View File

@ -1,26 +1,11 @@
import { useState } from 'react'
import { Resume as ResumeType } from 'types/graphql'
import PDF from 'src/components/PDF/PDF'
interface ResumeProps {
resume?: ResumeType
}
const Resume = ({ resume }: ResumeProps) => {
const [fileId] = useState<string>(resume?.fileId)
return (
<object
data={fileId}
type="application/pdf"
aria-label="Resume PDF"
style={{
width: 'calc(100vw - 1rem)',
height: 'calc(100vh - 6rem)',
}}
className="rounded-xl"
/>
)
}
const Resume = ({ resume }: ResumeProps) => <PDF url={resume?.fileId} />
export default Resume

View File

@ -14,6 +14,7 @@ import type {
import { TypedDocumentNode, useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import PDF from 'src/components/PDF/PDF'
import Uploader from 'src/components/Uploader/Uploader'
import { deleteFile, handleBeforeUnload } from 'src/lib/tus'
@ -100,16 +101,7 @@ const ResumeForm = ({ resume }: ResumeFormProps) => {
if (resume?.fileId)
return (
<div className="mx-auto w-fit space-y-2">
<object
data={resume?.fileId}
type="application/pdf"
aria-label="Resume PDF"
style={{
width: 'calc(100vw - 1rem)',
height: 'calc(100vh - 10rem)',
}}
className="rounded-xl"
/>
<PDF form url={resume?.fileId} />
<div className="flex justify-center">
<button
type="button"
@ -143,16 +135,7 @@ const ResumeForm = ({ resume }: ResumeFormProps) => {
/>
</>
) : (
<object
data={fileId}
type="application/pdf"
aria-label="Resume PDF"
style={{
width: 'calc(100vw - 1rem)',
height: 'calc(100vh - 10rem)',
}}
className="rounded-xl"
/>
<PDF form url={fileId} />
)}
{fileId && (
<div className="flex justify-center space-x-2">

View File

@ -97,7 +97,7 @@ const TitlesForm = ({ titles }: TitlesFormProps) => {
<nav className="my-2 flex justify-center space-x-2">
<button
type="button"
className="btn btn-sm"
className="btn btn-sm uppercase"
onClick={() => setPreview(!preview)}
>
{preview ? 'Hide' : 'Show'} Preview

View File

@ -13,45 +13,6 @@ import { DevFatalErrorPage } from '@redwoodjs/web/dist/components/DevFatalErrorP
export default DevFatalErrorPage ||
(() => (
<main>
<style
dangerouslySetInnerHTML={{
__html: `
html, body {
margin: 0;
}
html * {
box-sizing: border-box;
}
main {
display: flex;
align-items: center;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
text-align: center;
background-color: #E2E8F0;
height: 100vh;
}
section {
background-color: white;
border-radius: 0.25rem;
width: 32rem;
padding: 1rem;
margin: 0 auto;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
h1 {
font-size: 2rem;
margin: 0;
font-weight: 500;
line-height: 1;
color: #2D3748;
}
`,
}}
/>
<section>
<h1>
<span>Something went wrong</span>
</h1>
</section>
<span>Something went wrong</span>
</main>
))

View File

@ -72,7 +72,9 @@ const ForgotPasswordPage = () => {
<FieldError name="username" className="text-sm text-error" />
<div className="flex w-full">
<Submit className="btn btn-primary btn-sm mx-auto">Submit</Submit>
<Submit className="btn btn-primary btn-sm mx-auto uppercase">
Submit
</Submit>
</div>
</Form>
</div>

View File

@ -5,6 +5,7 @@ import { Link, routes } from '@redwoodjs/router'
import { Metadata } from '@redwoodjs/web'
import TitlesCell from 'src/components/Title/TitlesCell'
import { getLogoComponent } from 'src/lib/handle'
const HomePage = () => (
<>
@ -33,6 +34,16 @@ const HomePage = () => (
</div>
</div>
</div>
<div className="fixed bottom-2 left-2 z-10">
<a
href="https://git.altaiar.dev/ahmed/portfolio"
target="_blank"
rel="noreferrer"
className="btn btn-square"
>
{getLogoComponent('gitea')}
</a>
</div>
</>
)

View File

@ -103,7 +103,9 @@ const LoginPage = () => {
<FieldError name="password" className="text-sm text-error" />
<div className="flex w-full">
<Submit className="btn btn-primary btn-sm mx-auto">Log In</Submit>
<Submit className="btn btn-primary btn-sm mx-auto uppercase">
Log In
</Submit>
</div>
</Form>
</div>

View File

@ -102,7 +102,7 @@ const ResetPasswordPage = ({ resetToken }: { resetToken: string }) => {
<div className="flex w-full">
<Submit
className={`btn btn-primary btn-sm mx-auto ${
className={`btn btn-primary btn-sm uppercase mx-auto ${
!enabled ? 'btn-disabled' : ''
}`}
disabled={!enabled}