-
Notifications
You must be signed in to change notification settings - Fork 1
Add newPassword page #230
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: master
Are you sure you want to change the base?
Add newPassword page #230
Conversation
}; | ||
|
||
const useUpdatePasswordMutation = ( | ||
options?: MutationHookOptions<UpdatePasswordResponseData, UpdatePasswordRequestVariables>, |
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.
Should the options be optional for mutation?
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.
In this case it is required
|
||
NewPasswordPage.getInitialProps = ({ res, accessTokenManager }) => { | ||
if (accessTokenManager.accessToken) { | ||
if (res) { |
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.
I don't know why, but in other files we use the following conditions if (!!req && !!res) {
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.
Now for all pages we check only res, so I think we can leave it
return {}; | ||
}; | ||
|
||
export default withApolloClient(WithAuth(NewPasswordPage)); |
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.
Why don't you use WithAuthSecurity
HOC?
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.
I think we can leave as is, cause almost all pages do not use this HOC. I'll take a look at this in next prs
|
||
import { FieldWrapper, FormContentWrapper, SubmitButtonWrapper } from './styled'; | ||
|
||
const passwordRegularExp = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])([0-9A-Za-z#$@&!?.*^{}<>;,)(~'"=_%+-]+)$/; |
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.
better create new file with all regexp
.required('This field is required'), | ||
}); | ||
|
||
type ValuesFromFormik = { |
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.
rename ValuesFromFormik to FormValues. If we replace formik with another form, type of values should not change, as well as name of type
|
||
const passwordRegularExp = /^(?=.*[0-9])(?=.*[A-Z])(?=.*[a-z])([0-9A-Za-z#$@&!?.*^{}<>;,)(~'"=_%+-]+)$/; | ||
|
||
const initialValues = { |
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.
add type
@@ -0,0 +1,5 @@ | |||
mutation UpdatePassword($input: UpdatePasswordInput!) { | |||
updatePassword(input: $input) { | |||
accessToken |
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.
refreshToken
@@ -0,0 +1,5 @@ | |||
mutation UpdatePassword($input: UpdatePasswordInput!) { |
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.
Oyyy I didn't know what type for $input existed
Maybe better to rename all input type for mutation
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.
I'm sorry, but I don't understand your point. I think we can leave as is for now
onCompleted, | ||
}); | ||
|
||
const mutate = async ({ password, resetToken }: UpdatePasswordProps) => { |
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.
UpdatePasswordProps should be named UpdatePasswordVariables from 'api/types...'
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.
I fixed it
|
||
import useUpdatePasswordMutation from 'api/mutations/update/useUpdatePasswordMutation'; | ||
|
||
export type UpdatePasswordProps = { |
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.
Remove this type
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.
I fixed it
const NewPasswordPage = ({ query }) => { | ||
return ( | ||
<NotifierProvider> | ||
<DefaultTemplate testId="recovery-password-page"> |
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.
it is not recovery-password-page
|
||
import UpdatePasswordMutation from 'graphql/mutations/updatePassword.graphql'; | ||
|
||
import type { UpdatePasswordVariables, UpdatePasswordData } from '../../types/user/updatePasswordApiType'; |
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.
should be the absolute path
Summary
A brief description of the pull request.
Resolves: #138
Screenshots in case of UI changes
Review notes
While reviewing pull-request (especially when it's your pull-request), please make sure that:
.env.example
and added to Heroku