added login support as in chapter 8 of flask book.