<AuthPage> component from refine for Ant Design contains authentication pages that can be used to login, register, forgot password, and update password.
Before using <AuthPage> component you need to add authProvider that will be used to handle authentication.
Swizzle
You can swizzle this component to customize it with the refine CLI
After form submission, the login method of the authProvider will be called with the form values.
src/authProvider.ts
import{AuthProvider}from"@pankod/refine-core"; const authProvider:AuthProvider={ // -- login:async({ email, password, remember, providerName })=>{ // You can handle the login process according to your needs. // If the process is successful. returnPromise.resolve(); returnPromise.reject(); }, // -- };
After form submission, the register method of the authProvider will be called with the form values.
src/authProvider.ts
import{AuthProvider}from"@pankod/refine-core"; const authProvider:AuthProvider={ // -- register:async({ email, password, providerName })=>{ // You can handle the register process according to your needs. // If the process is successful. returnPromise.resolve(); returnPromise.reject(); }, // -- };
After form submission, the forgotPassword method of the authProvider will be called with the form values.
src/authProvider.ts
import{AuthProvider}from"@pankod/refine-core"; const authProvider:AuthProvider={ // -- forgotPassword:async({ email })=>{ // You can handle the reset password process according to your needs. // If process is successful. returnPromise.resolve(); returnPromise.reject(); }, // -- };
After form submission, the updatePassword method of the authProvider will be called with the form values.
src/authProvider.ts
import{AuthProvider}from"@pankod/refine-core"; const authProvider:AuthProvider={ // -- updatePassword:async({ password, confirmPassword })=>{ // You can handle the update password process according to your needs. // If the process is successful. returnPromise.resolve(); returnPromise.reject(); }, // -- };
providers property is only available for types login and register.
providers property defines the list of providers used to handle login authentication. providers accepts an array of Provider type. Check out the Interface section for more information.
localhost:3000/login
Live previews only work with the latest documentation.
rememberMe property is only available for type login.
rememberMe property defines to render your own remember me component or you can pass false to don't render it.
INFORMATION
You have to wrap your remember me component with Form.Item component from antd and pass the name prop to it then you can access its value from the formPropsonFinish function with formValues.
localhost:3000/login
Live previews only work with the latest documentation.
forgotPasswordLink property is only available for type login.
forgotPasswordLink property defines the link to the forgot password page and also you can give a node to render. The default value is "/forgot-password".
localhost:3000/login
Live previews only work with the latest documentation.
contentProps uses for passing props to the content component which is the card component. In the example below you can see that the title, header, and content styles are changed with contentProps.
localhost:3000/login
Live previews only work with the latest documentation.
formProps uses for passing props to the form component. In the example below you can see that the initialValues are changed with formProps and also the onFinish function is changed.
localhost:3000/login
Live previews only work with the latest documentation.
renderContent uses to render the form content. You can use this property to render your own content or renderContent gives you default content you can use to add some extra elements to the content.
localhost:3000/login
Live previews only work with the latest documentation.