Hexo管理接口忘记密码

hexo-admin管理接口忘记密码

修改node_modules/hexo-admin/auth/strategy.js中的认证代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function validate_credentials( executionScope, request, response, callback ) {
var config = hexo.config.admin
// if (request.body.username == config.username &&
// bcrypt.compareSync(request.body.password, config.password_hash)) {
// executionScope.success({name:request.body.user}, callback)
// }
if (true) {
executionScope.success({name:request.body.user}, callback)
}
else {
failed_validation(request, response);
}
}

重启hexo服务端后,进入hexo-admin输入任意密码即可进入后台,在通过Settings中的auth模块重新输出密码配置写入_config.yml,再重启hexo服务即可重置密码。  
记得重置密码后将node_modules/hexo-admin/auth/strategy.js修改回原始代码。