source: Dev/branches/rest-dojo-ui/client/rft/ui/LoginDialog.js @ 260

Last change on this file since 260 was 260, checked in by hendrikvanantwerpen, 13 years ago
  • Clear LoginDialog? on show (in case of re-show).
  • Allow to link nodes/widgets to rft.ui.Page members with data-rft-attach-point attribute.
  • Allow arguments to a page to be passed with data-rft-props argument. Content loader rft.content sets this argument on the top node of a loaded page.
  • Have longer cookie-lifetime and update cookie when session is restored. Allow session restore in API and client code.
  • Moved startup Javascript to rft/run.js.
File size: 1.2 KB
Line 
1define(['dojo/_base/declare','dojo/_base/lang','dijit/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) {
5        return declare([Dialog,_WidgetsInTemplateMixin], {
6            templateString: template,
7            widgetsInTemplate: true,
8            title: "Login",
9            baseClass: "rftLoginDialog",
10            show: function() {
11                this.loginErrors.innerHTML = '';
12                this.loginForm.reset();
13                this.inherited(arguments);
14            },
15            onLogin: function() {
16                this.loginErrors.innerHTML = '';
17                var data = this.loginForm.get('value');
18                var hide = lang.hitch(this,"hide");
19                auth.login(data.username,data.password)
20                .then(function() {
21                    hide();
22                    content.initial();
23                },function() {
24                    this.loginErrors.innerHTML = 'Login failed.';
25                })
26                return false;
27            }
28        });
29    });
Note: See TracBrowser for help on using the repository browser.