sended link status, sign out revoke token
This commit is contained in:
parent
1574fc083b
commit
e609eb09fa
|
@ -22,7 +22,7 @@ export const ForgotPasswordForm = () => {
|
||||||
setValidationErrors(({ email: _notNeeded, ...rest }) => rest)
|
setValidationErrors(({ email: _notNeeded, ...rest }) => rest)
|
||||||
setEmail(newEmail)
|
setEmail(newEmail)
|
||||||
}
|
}
|
||||||
|
const [sended, setSended] = createSignal(false)
|
||||||
const [submitError, setSubmitError] = createSignal('')
|
const [submitError, setSubmitError] = createSignal('')
|
||||||
const [isSubmitting, setIsSubmitting] = createSignal(false)
|
const [isSubmitting, setIsSubmitting] = createSignal(false)
|
||||||
const [validationErrors, setValidationErrors] = createSignal<ValidationErrors>({})
|
const [validationErrors, setValidationErrors] = createSignal<ValidationErrors>({})
|
||||||
|
@ -53,6 +53,7 @@ export const ForgotPasswordForm = () => {
|
||||||
try {
|
try {
|
||||||
const result = await signSendLink({ email: email(), lang: locale() })
|
const result = await signSendLink({ email: email(), lang: locale() })
|
||||||
if (result.error) setSubmitError(result.error)
|
if (result.error) setSubmitError(result.error)
|
||||||
|
else setSended(true)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setSubmitError(error.message)
|
setSubmitError(error.message)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -63,7 +64,12 @@ export const ForgotPasswordForm = () => {
|
||||||
return (
|
return (
|
||||||
<form onSubmit={handleSubmit}>
|
<form onSubmit={handleSubmit}>
|
||||||
<h4>{t('Forgot password?')}</h4>
|
<h4>{t('Forgot password?')}</h4>
|
||||||
|
<Show
|
||||||
|
when={!sended()}
|
||||||
|
fallback={<div class={styles.authInfo}>{t('Link sent, check your email')}</div>}
|
||||||
|
>
|
||||||
<div class={styles.authSubtitle}>{t('Everything is ok, please give us your email address')}</div>
|
<div class={styles.authSubtitle}>{t('Everything is ok, please give us your email address')}</div>
|
||||||
|
</Show>
|
||||||
<Show when={submitError()}>
|
<Show when={submitError()}>
|
||||||
<div class={styles.authInfo}>
|
<div class={styles.authInfo}>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
@ -11,12 +11,16 @@ export const signIn = async (params) => {
|
||||||
setToken(authResult.token)
|
setToken(authResult.token)
|
||||||
console.debug('signed in')
|
console.debug('signed in')
|
||||||
}
|
}
|
||||||
export const signOut = () => {
|
export const signOut = async () => {
|
||||||
// TODO: call backend to revoke token
|
const result = await apiClient.authSignOut()
|
||||||
|
if (result.error) {
|
||||||
|
console.error('[auth] sign out error', result.error)
|
||||||
|
} else {
|
||||||
setSession(null)
|
setSession(null)
|
||||||
resetToken()
|
resetToken()
|
||||||
console.debug('signed out')
|
console.debug('signed out')
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const [emailChecks, setEmailChecks] = createSignal<{ [email: string]: boolean }>({})
|
export const [emailChecks, setEmailChecks] = createSignal<{ [email: string]: boolean }>({})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user