Luci Working in OpenWRT

I am trying to build a custom image from openwrt 14.04 which currently has root user and not password. my aim is to force user to set password before accessing any pages. I am unable to find out the way Luci works in openwrt the sequence of hooks or function calls that will be helpfull to find out what happens when one opens the login page and who call the login page to render. Also what happens when login button is clicked. which functions or hookes are evoked and how are the pages displayed. If any one can help me in understanding the flow of Luci that will be greatful. It is not intended to explain in depth the complete Luci but doing so will be really grateful.