Skip to content

Conversation

@hwong0305
Copy link
Collaborator

@hwong0305 hwong0305 commented May 28, 2020

This is part of multiple PRs to add reset Password functionality

  • Adds Helper Functions for sending emails
  • Adds resolver functions for resetting password, and changing password
  • Add changing password functionality on Mattermost

The second PR will add the resolvers to GraphQL server, update Signup and make changes to Front End

Screenshot for Reset Password Email Template
image

@vercel
Copy link

vercel bot commented May 28, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/c0d3/c0d3-app/9sjz6t20v
✅ Preview: https://c0d3-app-git-fork-hwong0305-reset-1.c0d3.now.sh

@codecov
Copy link

codecov bot commented May 28, 2020

Codecov Report

Merging #223 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #223   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           44        47    +3     
  Lines          596       679   +83     
  Branches       138       151   +13     
=========================================
+ Hits           596       679   +83     
Impacted Files Coverage Δ
graphql/queries.ts 100.00% <100.00%> (ø)
helpers/controllers/authController.ts 100.00% <100.00%> (ø)
helpers/controllers/passwordController.ts 100.00% <100.00%> (ø)
helpers/encoding.ts 100.00% <100.00%> (ø)
helpers/findUser.ts 100.00% <100.00%> (ø)
helpers/formValidation.tsx 100.00% <100.00%> (ø)
helpers/mail.ts 100.00% <100.00%> (ø)
helpers/mattermost.ts 100.00% <100.00%> (ø)
... and 1 more

@hwong0305 hwong0305 changed the title [1 / 2] - Backend Functionality for Reset Password [1 / 3] - Backend Functionality for Reset Password May 28, 2020
}

let user: any
if (userOrEmail.indexOf('@') !== -1) {
Copy link
Contributor

@songz songz May 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be a really useful util function, like const user = getUserByEmailOrUsername( userOrEmail )

Util function could do the throwing and input validation, making this reqPwReset function much smaller.

Util function will throw invalid input and user does not exist, so you are guaranteed to have a user object.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you make this a util function, we could potentially use this in login as well!

user.expiration = null
user.forgotToken = null
user.password = hash
await user.save()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to do this after changeChatPassword. This prevents our pw from being out of sync with chat.

.max(TEXT_MAX, `Must be ${TEXT_MAX} characters or less`)
.trim('Leading and trailing value must be alphanumeric character')
.required('Required'),
password: Yup.string()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this affect the signup password validation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooooo there's no password inputs for signup anymore :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to move this to a different PR. I don't want to break production on this one.

@songz songz merged commit 82d5522 into garageScript:master May 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants