To use any application online, you have to authenticate and The Globe In My Bucket Application (TGIMBA) is no different – we need a login screen. But before that, you need a place to store the evaluation of those credentials. Storage will be done using Hyper Text Markup Language (HTML) 5’s sessionStorage (reference #1).
NOTE: This will likely change in the future because I also want to support other types of authentication such as Facebook and Google.
- If you look at my github repository, you might notice JQuery is there. But this is to support a small app I wrote some years back to study Spanish. It is not used in TGIMBA and this is one of the big differences between this and the previous TGIMBA version.
- I will not be testing sessionStorage being null or undefined as it is part of the HTML 5 spec and should be there. When I first started programming, I checked everywhere for null as well as wrapped everything in try/catch’s. Over time, I have learned that this is usually not a good thing. Over use of try/catch’s can hide errors. You generally only use those if you can recover. If not, you let the application fail with some global error handler. Over checking for null/undefined is also generally not a good thing. A very smart guy I worked with at Quicken Loans had a philosophy of only boundary checking (i.e. in and out of your system). Other locations internally, you assume it is set correctly.
- I added some basic styling to the login user control. I will remove this once functionality is done and I start the .css phase.
- Bad credentials – enter username and password
- Bad credentials – alert
- Good credentials – main page (login screen not show)
If not you notice, I ended up mocking out Login_Index() and Login_Cancel(). I plan to do the same with Login_Login() as I add the ability for a user to register in the next blog post.