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 // the database. Returning anything truthy will automatically log the user
// in. Return `false` otherwise, and in the Reset Password page redirect the // in. Return `false` otherwise, and in the Reset Password page redirect the
// user to the login page. // user to the login page.
handler: (_user) => { handler: (_user) => false,
return true
},
// If `false` then the new password MUST be different from the current one // If `false` then the new password MUST be different from the current one
allowReusedPassword: true, allowReusedPassword: true,

View File

@ -15,15 +15,14 @@ const transporter = nodemailer.createTransport({
}, },
}) })
export const sendEmail = async ({ to, subject, text, html }: Options) => { export const sendEmail = async ({ to, subject, text, html }: Options) =>
return await transporter.sendMail({ await transporter.sendMail({
from: `"${process.env.FIRST_NAME} ${process.env.LAST_NAME} (noreply)" <${process.env.GMAIL}>`, from: `"${process.env.FIRST_NAME} ${process.env.LAST_NAME} (noreply)" <${process.env.GMAIL}>`,
to: Array.isArray(to) ? to : [to], to: Array.isArray(to) ? to : [to],
subject, subject,
text, text,
html, html,
}) })
}
export const censorEmail = (email: string): string => { export const censorEmail = (email: string): string => {
const [localPart, domain] = email.split('@') 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 ( return (
<div className="mx-auto w-fit space-y-2"> <div className="mx-auto w-fit space-y-2">
<img <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} src={portrait?.fileId}
alt={`${process.env.FIRST_NAME} Portrait`} alt={`${process.env.FIRST_NAME} Portrait`}
/> />

View File

@ -1,26 +1,11 @@
import { useState } from 'react'
import { Resume as ResumeType } from 'types/graphql' import { Resume as ResumeType } from 'types/graphql'
import PDF from 'src/components/PDF/PDF'
interface ResumeProps { interface ResumeProps {
resume?: ResumeType resume?: ResumeType
} }
const Resume = ({ resume }: ResumeProps) => { const Resume = ({ resume }: ResumeProps) => <PDF url={resume?.fileId} />
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"
/>
)
}
export default Resume export default Resume

View File

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

View File

@ -13,45 +13,6 @@ import { DevFatalErrorPage } from '@redwoodjs/web/dist/components/DevFatalErrorP
export default DevFatalErrorPage || export default DevFatalErrorPage ||
(() => ( (() => (
<main> <main>
<style <span>Something went wrong</span>
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>
</main> </main>
)) ))

View File

@ -72,7 +72,9 @@ const ForgotPasswordPage = () => {
<FieldError name="username" className="text-sm text-error" /> <FieldError name="username" className="text-sm text-error" />
<div className="flex w-full"> <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> </div>
</Form> </Form>
</div> </div>

View File

@ -5,6 +5,7 @@ import { Link, routes } from '@redwoodjs/router'
import { Metadata } from '@redwoodjs/web' import { Metadata } from '@redwoodjs/web'
import TitlesCell from 'src/components/Title/TitlesCell' import TitlesCell from 'src/components/Title/TitlesCell'
import { getLogoComponent } from 'src/lib/handle'
const HomePage = () => ( const HomePage = () => (
<> <>
@ -33,6 +34,16 @@ const HomePage = () => (
</div> </div>
</div> </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" /> <FieldError name="password" className="text-sm text-error" />
<div className="flex w-full"> <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> </div>
</Form> </Form>
</div> </div>

View File

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