Browse Source

Merge pull request #1825 from nocodb/fix/change-password

fix: change password
pull/1829/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
1aae0f330d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      packages/nc-gui/pages/user/settings/index.vue
  2. 3
      packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts

19
packages/nc-gui/pages/user/settings/index.vue

@ -220,14 +220,20 @@ export default {
async resetUserPassword(e) {
e.preventDefault()
if (this.$refs.formType[0].validate()) {
// console.log('passworDetails',this.passwordDetails);
const err = await this.$store.dispatch('users/ActPostPasswordChange', this.passwordDetails)
if (err) {
this.formUtil.formErr = true
this.formUtil.formErrMsg = err.data.msg
} else {
try {
await this.$api.auth.passwordChange(
{
currentPassword: this.passwordDetails.currentPassword,
newPassword: this.passwordDetails.newPassword
}
)
this.$toast.success('Password changed successfully.').goAway(3000)
this.$refs.formType[0].reset()
} catch (e) {
this.$toast
.error(await this._extractSdkResponseErrorMsg(e))
.goAway(3000);
return;
}
}
},
@ -251,6 +257,7 @@ export default {
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
* @author Wing-Kam Wong <wingkwong.code@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*

3
packages/nocodb/src/lib/noco/meta/api/userApi/userApis.ts

@ -443,6 +443,7 @@ const mapRoutes = router => {
);
router.post('/auth/token/refresh', ncMetaAclMw(refreshToken, 'refreshToken'));
// new API
router.post('/api/v1/db/auth/user/signup', catchError(signup));
router.post('/api/v1/db/auth/user/signin', catchError(signin));
router.get(
@ -464,7 +465,7 @@ const mapRoutes = router => {
catchError(emailVerification)
);
router.post(
'/user/password/change',
'/api/v1/db/auth/password/change',
ncMetaAclMw(passwordChange, 'passwordChange')
);
router.post(

Loading…
Cancel
Save