-
Notifications
You must be signed in to change notification settings - Fork 9
Feature/login and reset password form #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
55643ac
to
b7815c8
Compare
…or reset password page
da193cc
to
a3d2d9e
Compare
…b.com/o2sdev/openselfservice into feature/login-and-reset-password-form
</Typography> | ||
<div className="flex flex-col gap-12 w-full"> | ||
<div className="flex flex-col gap-6"> | ||
{labels.resetPasswordMessage && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs another condition - labels should always be provided, but the message itself should be displayed based on an URL parameter, e.g. ?passwordReset=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I made a change.
<div className="flex flex-col gap-12 w-full"> | ||
<div className="flex flex-col gap-6"> | ||
{labels.resetPasswordMessage && ( | ||
<Banner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
<Typography variant="small" className="mt-1"> | ||
{labels.invalidCredentials} | ||
{labels.newPasswordMessage && ( | ||
<Banner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
{validations && ( | ||
<InputValidations | ||
targetInputName={field.name} | ||
validations={validations as InputValidationRegExpLabel[]} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this casting be removed if you type it as validations: InputValidationRegExpLabel[]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course - I changed it.
useEffect(() => { | ||
onValid && onValid(active.every((el) => el)); | ||
}, [active, onValid]); | ||
return ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style - let's add an empty line between main parts of code (e.g. here before and after useEffect
) for clarity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Changed.
return ( | ||
<div className="grid grid-cols-2 gap-2"> | ||
{validations.map(({ label }, index) => ( | ||
<div className="flex items-center gap-2" key={`${label}-${index}`}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it could be a list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good idea. I handled 2 situations - when map includes the only one element it is rendered in a <div>
structure for more elements as a list
@@ -6,7 +6,7 @@ export const AuthLayout: React.FC<AuthLayoutProps> = ({ layout = 'main-side', to | |||
const main = ( | |||
<div className="flex flex-col md:max-w-[50%] w-full p-4"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps the content should be centered vertically on mobile as well (it already is on desktop)? we could consult UX about this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good idea - I made a change.
import { FormValues, ResetPasswordFormProps } from './ResetPassword.types'; | ||
|
||
export const ResetPasswordForm: React.FC<Readonly<ResetPasswordFormProps>> = ({ labels, onResetPassword }) => { | ||
const [isSubmitting, setIsSubmitting] = useState(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be replaced with the new feature in react 19 https://react.dev/reference/react/useTransition (there are some examples of this in the app)
here and in other forms (sign-in, create new password)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added also to SignInForm and CreateNewPasswordForm. I also added LoadingOverlay.
forgotPassword?: { | ||
label: string; | ||
link: string; | ||
}; | ||
resetPasswordMessage?: { | ||
title?: string; | ||
description?: string; | ||
}; | ||
newPasswordMessage?: { | ||
title?: string; | ||
description?: string; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's make these mandatory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Small UI changes in SingIn Form
Adding reset password form.