Changeset 263 for Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js
- Timestamp:
- 02/16/12 14:47:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js
r260 r263 1 define(['dojo/_base/declare','dojo/_base/lang','d ijit/Dialog','dijit/_WidgetsInTemplateMixin',2 ' ../auth', 'dojo/text!./LoginDialog.html','../content',3 ' dijit/form/Form','dijit/form/Button','dijit/form/TextBox'],4 function (declare, lang, Dialog, _WidgetsInTemplateMixin, auth, template, content) {1 define(['dojo/_base/declare','dojo/_base/lang','dojo/_base/event','dijit/Dialog', 2 'dijit/_WidgetsInTemplateMixin','../auth', 'dojo/text!./LoginDialog.html', 3 '../content','dijit/form/Form','dijit/form/Button','dijit/form/TextBox'], 4 function (declare, lang, event, Dialog, _WidgetsInTemplateMixin, auth, template, content) { 5 5 return declare([Dialog,_WidgetsInTemplateMixin], { 6 6 templateString: template, … … 8 8 title: "Login", 9 9 baseClass: "rftLoginDialog", 10 startup: function() { 11 this.inherited(arguments); 12 this.loginForm.on('submit',lang.hitch(this,'onLogin')); 13 }, 10 14 show: function() { 11 15 this.loginErrors.innerHTML = ''; … … 13 17 this.inherited(arguments); 14 18 }, 15 onLogin: function( ) {19 onLogin: function(evt) { 16 20 this.loginErrors.innerHTML = ''; 17 21 var data = this.loginForm.get('value'); 18 var hide = lang.hitch(this,"hide");19 22 auth.login(data.username,data.password) 20 .then( function() {21 hide();23 .then(lang.hitch(this,function() { 24 this.hide(); 22 25 content.initial(); 23 } ,function() {26 }),lang.hitch(this,function() { 24 27 this.loginErrors.innerHTML = 'Login failed.'; 25 }) 28 })); 29 event.stop(evt); 26 30 return false; 27 31 }
Note: See TracChangeset
for help on using the changeset viewer.