更新
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* app.components.registered.accountPassword
|
||||
* 账号密码注册
|
||||
* @param {string} data.account 账号.
|
||||
* @param {string} data.password 密码.
|
||||
* @return {boolean} 注册 是否 成功.
|
||||
*/
|
||||
module.exports = async (data) => {
|
||||
const {account, password} = data
|
||||
const salt = app.components.encrypt.getRandomSalt()
|
||||
const md5 = app.components.encrypt.cryptPwd(password, salt)
|
||||
await app.db.table("User").data({account, password: md5, salt}).save()
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user