os-js / osjs-client

OS.js Client Module
https://manual.os-js.org/
Other
31 stars 31 forks source link

Adding register option into login page #145

Open mahsashadi opened 3 years ago

mahsashadi commented 3 years ago

Hi. I plan to add register option into login page, so the registered user can login into OSjs desktop with his/her new account. What changes do I need to apply and which files need to be modified?

andersevenrud commented 3 years ago

Hi,

The underlying authentication system supports registration, however the standard provided login UI box does not.

Are you using a custom login box ? If so then I can show you how to implement this.


FYI: I released @osjs/client@3.5.1 today with some new events to help out with this.

It adds register:* equivalent events for the login:* ones that are in this article: https://manual.os-js.org/guide/login/#adapter

andersevenrud commented 3 years ago

however the standard provided login UI box does not.

I could add support for this, but not sure when I have time for this.

mahsashadi commented 3 years ago

Are you using a custom login box ? If so then I can show you how to implement this

No, we are using the default login box. Maybe we only need to add one other input field in client configuration, in addition to username and password.

We develop an adapter for AuthServiceProvider which uses a remote account to authenticate. We aim at having register option to add a new remote account and login to OSjs with this new account.

andersevenrud commented 3 years ago

Maybe we only need to add one other input field in client configuration, in addition to username and password.

Currently, adding a button to the configuration doesn't really do anything. The dialog needs to be changed in the following way:

We develop an adapter for AuthServiceProvider which uses a remote account to authenticate.

Just use the register() method here on your adapter. This has the same signature as login.

mahsashadi commented 3 years ago

Currently, adding a button to the configuration doesn't really do anything

I think it is misunderstood, I mean that we did not write an adapter for login page. We have Username, Password, and one additional Domain input filed in login page.

So as I understand, the login and register page/from are the same and the user can choose whether login button or register button. A different page/form is not loaded for the user registration.

I could add support for this, but not sure when I have time for this.

Fortunately we are not in hurry if you plan to add this option.

andersevenrud commented 3 years ago

So as I understand, the login and register page/from are the same and the user can choose whether login button or register button.

Correct. This was my thought.

A different page/form is not loaded for the user registration.

It could be changed to have to views: login and registration. But this would involve a lot of changes because of how it is designed because of the configuration options to change the layout.

I think I might just rewrite the login UI and export this as a class that can be inherited to change both the behavior and layouts instead of the configuration (and have some backward compatibility for it all).

Fortunately we are not in hurry if you plan to add this option.

Great. If you have some ideas or requirements put them here and I will take it into consideration when I start looking at this.

mahsashadi commented 3 years ago

Great. If you have some ideas or requirements put them here and I will take it into consideration when I start looking at this.

Thanks a lot, I will leave my ideas here if there is any. So we are waiting for you to support this :+1: