Move allauth + auth UI to legacy/
allauth/ (44 files) is a django-allauth React UI — a separate concern from the Mizan protocol. Moved to legacy/ pending extraction into a standalone mizan-django-allauth package. Also moved to legacy/: - client/AuthContext.tsx — generic auth state from /me endpoint - client/RouterContext.tsx — framework-agnostic router adapter - client/routing.tsx — UserRoute/StaffRoute/AnonymousRoute guards - client/nextjs.tsx — Next.js router adapter for auth These are auth UI infrastructure, not Mizan protocol. The Mizan core only needs JWT for auth header selection (jwt/ stays — MizanProvider depends on useJWT() to decide between Bearer and session auth). Cleaned up re-exports in client/react.ts and vitest aliases. 33 React tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
54
legacy/allauth/components/settings/PasswordSection.tsx
Normal file
54
legacy/allauth/components/settings/PasswordSection.tsx
Normal file
@@ -0,0 +1,54 @@
|
||||
'use client'
|
||||
|
||||
import { useDjangoFormCore } from 'mizan'
|
||||
import { useStyles } from '../../contexts/StylesContext'
|
||||
import { SettingsSection, Button } from './SettingsComponents'
|
||||
|
||||
export function PasswordSection() {
|
||||
const styles = useStyles()
|
||||
const form = useDjangoFormCore<Record<string, unknown>>({ name: 'change_password' })
|
||||
|
||||
const handleSubmit = async (e: React.FormEvent) => {
|
||||
e.preventDefault()
|
||||
const result = await form.submit()
|
||||
if (result.success) {
|
||||
form.reset()
|
||||
alert('Password changed successfully!')
|
||||
}
|
||||
}
|
||||
|
||||
if (form.loading) return null
|
||||
|
||||
return (
|
||||
<SettingsSection title={form.schema?.title || 'Change Password'}>
|
||||
<form onSubmit={handleSubmit} className={styles.form}>
|
||||
<div className={styles.fieldsContainer}>
|
||||
{form.schema?.fieldOrder.map(fieldName => {
|
||||
const field = form.schema!.fields[fieldName]
|
||||
return (
|
||||
<div key={fieldName} className={styles.field}>
|
||||
<label className={styles.fieldLabel}>{field.label}</label>
|
||||
<input
|
||||
type={field.type}
|
||||
value={(form.data[fieldName] as string) || ''}
|
||||
onChange={(e) => form.set(fieldName, e.target.value)}
|
||||
onBlur={() => form.touch(fieldName)}
|
||||
className={styles.fieldInput}
|
||||
required={field.required}
|
||||
/>
|
||||
{form.touchedFields.has(fieldName) &&
|
||||
form.getFieldErrors(fieldName).map((err, i) => (
|
||||
<p key={i} className={styles.fieldError}>{err.message}</p>
|
||||
))
|
||||
}
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
<Button type="submit" disabled={form.submitting}>
|
||||
{form.submitting ? 'Changing...' : (form.schema?.submit_label || 'Change Password')}
|
||||
</Button>
|
||||
</form>
|
||||
</SettingsSection>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user