Last change
on this file since 490 was
468,
checked in by hendrikvanantwerpen, 12 years ago
|
Improved authentication
- Authentication cannot be cancelled, removing a lot of weird race
conditions.
- We offer a request provider that has automatic retry in case of
authentication failures.
- Reduced dependency on LoginDialog? by having it act independent
based on events. Other modules can just depend on 'session'.
|
File size:
880 bytes
|
Line | |
---|
1 | define [ |
---|
2 | "../session", |
---|
3 | "./LoginDialogWrapper", |
---|
4 | "dijit/MenuBarItem", |
---|
5 | "dojo/_base/declare", |
---|
6 | "dojo/_base/event", |
---|
7 | "dojo/on" |
---|
8 | ], (session, LoginDialogWrapper, MenuBarItem, declare, event, _on) -> |
---|
9 | declare [MenuBarItem], |
---|
10 | info: null |
---|
11 | postCreate: () -> |
---|
12 | @set 'label', "Login" |
---|
13 | startup: () -> |
---|
14 | if @_started then return |
---|
15 | @inherited arguments |
---|
16 | @_update session.get() |
---|
17 | _on session, 'change', (info) => @_update info |
---|
18 | _update: (info) -> |
---|
19 | @info = info |
---|
20 | if info |
---|
21 | @set 'label', "Logout, "+info.username |
---|
22 | else |
---|
23 | @set 'label', "Login" |
---|
24 | onClick: (evt) -> |
---|
25 | if @info |
---|
26 | session.logout() |
---|
27 | else |
---|
28 | LoginDialogWrapper.show() |
---|
29 | event.stop evt if evt |
---|
30 | false |
---|
Note: See
TracBrowser
for help on using the repository browser.