JOE
2018-10-23 fe715b1cb31a74ca32f0222d053ab14bab9e51d0
modify url path
5 files modified
10 ■■■■ changed files
.gitignore 1 ●●●● patch | view | raw | blame | history
routes/accounts.js 3 ●●●●● patch | view | raw | blame | history
views/accounts/list.html 2 ●●● patch | view | raw | blame | history
views/modules/list.html 2 ●●● patch | view | raw | blame | history
views/roles/list.html 2 ●●● patch | view | raw | blame | history
.gitignore
....@@ -6,6 +6,7 @@
66 yarn-error.log*
77
88 server.js
9
+config/config.js
910
1011 # Runtime data
1112 pids
routes/accounts.js
....@@ -35,6 +35,9 @@
3535
3636 router.post('/create', function(req, res, next) {
3737 const data = Object.assign(req.body) || {};
38
+ let hash = bcrypt.hashSync(data.passwd, 10);
39
+ data.passwd = hash;
40
+
3841 Account.create(data).then(role => {
3942 res.redirect(config.path.context + '/accounts/');
4043 }).catch(err => {
views/accounts/list.html
....@@ -16,7 +16,7 @@
1616 if(confirm("Are you sure you want to delete this?")){
1717 const id = $(this).attr('id');
1818 $.ajax({
19
- url: "/api/accounts/" + id,
19
+ url: "{{context}}/api/accounts/" + id,
2020 method:"delete"
2121 }).done(function(data) {
2222 if(data.deleted == 1) {
views/modules/list.html
....@@ -16,7 +16,7 @@
1616 if(confirm("Are you sure you want to delete this?")){
1717 const id = $(this).attr('id');
1818 $.ajax({
19
- url: "../api/modules/" + id,
19
+ url: "{{context}}/api/modules/" + id,
2020 method:"delete"
2121 }).done(function(data) {
2222 if(data.deleted == 1) {
views/roles/list.html
....@@ -15,7 +15,7 @@
1515 if(confirm("Are you sure you want to delete this?")){
1616 const id = $(this).attr('id');
1717 $.ajax({
18
- url: "../api/roles/" + id,
18
+ url: "{{context}}/api/roles/" + id,
1919 method:"delete"
2020 }).done(function(data) {
2121 if(data.deleted == 1) {