To implement this approach look at the way this is done in the Adminstration module from the appstore, this should clarify things.
As to not being able to login, are there any error messages in the console of Studio Pro or the logfile. It might be the case that the user does not have any roles assigned and then the message shown above will appear as well. But in this case the console will show the real cause of the user not being able to sign in.
On button click call microflow, in micro flow take commit activity , decision box and than show page activity.
in commit take your data source , use decision if false use validation message.
in your Entity UserId and password attribute must be in registration entity and login entity