Skip to content
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

Password change bug fix #803

Merged
merged 3 commits into from
Oct 28, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ export default function useCustomer() {
* @param {object} data
* @param {string} data.currentPassword - The old password.
* @param {string} data.password - The new password.
* @param {string} email - Customer's email
*/
async updatePassword(data) {
async updatePassword(data, email) {
const body = {
password: data.password,
currentPassword: data.currentPassword
Expand All @@ -200,6 +201,14 @@ export default function useCustomer() {
throw new Error(json.detail)
}
}

// Fetch a new SLAS JWT to update the invalid one in client app state
const credentials = {
email: email,
password: data.password
}

await self.login(credentials)
},

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const PasswordCard = () => {
const submit = async (values) => {
try {
form.clearErrors()
await customer.updatePassword(values)
await customer.updatePassword(values, customer.email)
setIsEditing(false)
toast({
title: formatMessage({
Expand Down