Add an administrator user

Learn, by newghost Support 1407071425318


There is no default administrator user account.

There is a default user "guest",password is "123456"

Here is the way to create an administrator user account.

1) Change CRYPTOKEY

After installation you'd better change the CRYPTOKEY in ourjs/config.magazine.js first, this key is used for encrypt the password。Once you change the CRYPTOKEY, you can't log in with "guest" any more. 

2) Register a new account

After registration on the web. Edit the user you just added, it's in the folder: ourjs/data/models/user, etc:

/var/www/ourjs/data/models/user$ sudo nano 54de5426986df9bb010b5169

Add a new property "isAdmin": 1

{"username":"youraccount","password":"fc07b10fe29df08108dfce486afdf4e9b2","email":"kris.newghost@gmail.com","joinedTime":1407058982952,"_id":"54de0456986df9bb010b5169","company":"","briefinfo":"","isAdmin":1}

3) Restart the web server

Kill the thread of ./ourjs.js config.magazine.js (it will restart by "etc/init.d/ourjs" thread immediately), etc:

admin@ip-172-31-16-67:/var/www/ourjs/data/models/user$ ps aux | grep ourjs
root 438 0.0 0.0 3956 624 ? S 09:13 0:00 /bin/sh /etc/init.d/ourjs start
root 1165 1.4 5.2 630868 32692 ? Sl 12:46 0:12 /root/local/bin/node /var/www/ourjs/svr/ourjs.js config.magazine.js
admin 1180 0.0 0.1 7548 848 pts/0 S+ 13:01 0:00 grep ourjs
admin@ip-172-31-16-67:/var/www/ourjs/data/models/user$ sudo kill 1165

Refresh the web twice.

This is to refresh the cache of users, once you became an administrator, you can refresh directly via this URL after you update any data models: 

http://localhost:8054/updatecache






25 COMMENTS