Login screen not showing up


#1

Whenever i start the osjs, it will run straight into the desktop without login screen. What should i do to call up that screen?

An other question is that how i can add more users? The script add-user.js asks me to do via “system” but i dont quite get it.


#2

You need to set up authentication: https://manual.os-js.org/configuration/authenticator/


#3

I followed the instructions but that didnt end well:
At first, i tried with mysql, however, the mysql server service didnot start on my computer. Therefore, the last step “set up database” could not be finished.
So i switch to sqlite. This time, all went well, except i can not add user with the following error message:

E:\osjs>node bin/add-user.js add han admin
Using authenticator database at E:\osjs\src\server\node\modules\auth\database
>mysql osjsuser@localhost:/osjs
(node:6088) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Cannot find module ‘mysql’
(node:6088) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


#4

Did you forget to run the npm install commands noted in instructions ?


#5

Also, it says “mysql” in the output, so I’m not sure that you’ve switched over to sqlite properly.


#6

Yeah, I decided then to start all over again and use sqlite3.
The packages have been installed successfully, but add-user.js doesnt seem work.

E:\OS.js>node bin/add-user.js add han admin
Using authenticator database at E:\OS.js\src\server\node\modules\auth\database
> sqlite authstorage.sqlite
[ undefined ]


#7

That’s actually correct behavior. The undefined thingy is just a bug in the error handler (undefined error, which is good :P).


#8

Well, but then how i can login as “han” when i still didnt set up the password for user?


#9

node bin/add-user.js pwd han.


#10

E:\OS.js>node bin/add-user.js pwd han
Using authenticator database at E:\OS.js\src\server\node\modules\auth\database
> sqlite authstorage.sqlite
{ Error: SQLITE_ERROR: no such table: users errno: 1, code: ‘SQLITE_ERROR’ }

Strange behavior?


#11

Do you have src/server/authstorage.sqlite ?


#12

I recopy src\templates\misc\authstorage.sqlite to src/server/, type node bin/add-user.js pwd han and that demands me a new password indeed. However, the return message sounds not good:

(node:8952) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property ‘id’ of null
(node:8952) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

When i restart the server, it doesnt accept the new user with the password i chose.


#13

Well, if you re-copy the file the user you added is now gone. The authstorage.sqlite is the database.


#14

Thank you for your indication. That’s my fault :frowning: It works now.
By the way, how many user groups are there by default? And can we create a new one?


#15

See src/conf/200-server.json as a reference.

  • server.api.groups Map: endpoint => group-name. Where an endpoint is a route on the backend.
  • server.vfs.groups Map: mountpoint => group-name. Where mountpoint is a key in the VFS mountpoints tree.

https://manual.os-js.org/configuration/#add-permission-to-api-endpoint

You can of course add any arbitrary group to your users if you plan to make something in the client that makes use of them.