Mastering Web Application

(Rick Simeone) #1

Securing Your Application


Showing a login form


We need to allow the user to login to the application. The login form provides this.
It is actually comprised of a template (security/login/form.tpl.html), and a
controller (LoginFormController). The security service opens (showLogin())
or closes (login() or cancelLogin()) the login form, when authentication is
required or requested.


We are using the AngularUI bootstrap project's $dialog service for this. This
service allows us to display a form as a modal dialog box, by specifying a template
and a controller for the form.


You can find out more about the $dialog service at its website: http://angular-
ui.github.io/bootstrap/#/dialog.


In our security service, we have the two helpers: openLoginDialog() and
closeLoginDialog().


var loginDialog = null;
function openLoginDialog() {
if ( !loginDialog ) {
loginDialog = $dialog.dialog();
loginDialog.open(
'security/login/form.tpl.html',
Free download pdf