mirror of
https://github.com/ragestudio/comty.js.git
synced 2025-06-09 02:24:18 +00:00
fix import
This commit is contained in:
parent
88c06c1f70
commit
4d90a7cc5a
@ -78,7 +78,7 @@ export default class AuthModel {
|
||||
password,
|
||||
email,
|
||||
accept_tos: tos,
|
||||
}
|
||||
},
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
|
||||
@ -108,8 +108,8 @@ export default class AuthModel {
|
||||
method: "POST",
|
||||
url: "/auth/token",
|
||||
data: {
|
||||
token: token
|
||||
}
|
||||
token: token,
|
||||
},
|
||||
})
|
||||
|
||||
return response.data
|
||||
@ -156,7 +156,7 @@ export default class AuthModel {
|
||||
params: {
|
||||
username,
|
||||
email,
|
||||
}
|
||||
},
|
||||
}).catch((error) => {
|
||||
console.error(error)
|
||||
|
||||
@ -169,21 +169,25 @@ export default class AuthModel {
|
||||
/**
|
||||
* A function to change the user's password.
|
||||
*
|
||||
* @param {Object} payload - An object containing the currentPassword and newPassword.
|
||||
* @param {Object} payload - An object containing the currentPassword, newPassword, and code.
|
||||
* @param {string} payload.currentPassword - The current password of the user.
|
||||
* @param {string} payload.newPassword - The new password to set for the user.
|
||||
* @param {string} [payload.code] - The activation code sent to the user's email, optional if the old password is provided.
|
||||
* @return {Promise<Object>} The data response after changing the password.
|
||||
*/
|
||||
static async changePassword(payload) {
|
||||
const { currentPassword, newPassword } = payload
|
||||
const { currentPassword, newPassword, code, verificationToken } =
|
||||
payload
|
||||
|
||||
const { data } = await request({
|
||||
method: "put",
|
||||
url: "/auth/password",
|
||||
data: {
|
||||
code: code,
|
||||
verificationToken: verificationToken,
|
||||
old_password: currentPassword,
|
||||
new_password: newPassword,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
return data
|
||||
@ -204,7 +208,7 @@ export default class AuthModel {
|
||||
data: {
|
||||
code: code,
|
||||
user_id: user_id,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
return data
|
||||
@ -223,7 +227,7 @@ export default class AuthModel {
|
||||
url: "/auth/resend-activation-code",
|
||||
data: {
|
||||
user_id: user_id,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
return data
|
||||
@ -231,7 +235,9 @@ export default class AuthModel {
|
||||
|
||||
static async disableAccount({ confirm = false } = {}) {
|
||||
if (!confirm) {
|
||||
console.error("In order to disable your account, you must confirm the action.")
|
||||
console.error(
|
||||
"In order to disable your account, you must confirm the action.",
|
||||
)
|
||||
return null
|
||||
}
|
||||
|
||||
@ -244,4 +250,16 @@ export default class AuthModel {
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
static async recoverPassword(usernameOrEmail) {
|
||||
const { data } = await request({
|
||||
method: "post",
|
||||
url: "/auth/recover-password",
|
||||
data: {
|
||||
account: usernameOrEmail,
|
||||
},
|
||||
})
|
||||
|
||||
return data
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user