Login
Let's jump back and build our login widget back in app.js
. We'll also add a greeting for our user once they sign in.
Refresh and take a look at our login box. Looking good!
Now we'll try and actually connect it to Aft. Add a submit
callback and connect it to the button's onClick
property.
Notice how we're invoking the aft "login" RPC. Aft RPCs accept and return a single JSON object. We're able to just call the RPC by name like a native function thanks to the Proxy magic we did earlier in aft.js
.
#
Adding a userIf you go ahead and try to sign in to our tutorial app, you should of course get an error about the login not working—we haven't added any users yet!
Open up Aft at http://localhost:8081
, and navigate to the Terminal, and we'll create a user.
Press Run, and you should see a JSON representation of the user just created, though the password is salted and hashed.
Go back to the tutorial app, and try signing in with your new credentials.
In the next section, we'll finish up the login system, using the me
RPC.