Lines 82-87
define([
|
Link Here
|
---|
|
82 |
"umc/widgets/GalleryPane", |
82 |
"umc/widgets/GalleryPane", |
83 |
"umc/widgets/ContainerWidget", |
83 |
"umc/widgets/ContainerWidget", |
84 |
"umc/widgets/Page", |
84 |
"umc/widgets/Page", |
|
|
85 |
"umc/widgets/PasswordBox", |
86 |
"umc/widgets/PasswordInputBox", |
85 |
"umc/widgets/Form", |
87 |
"umc/widgets/Form", |
86 |
"umc/widgets/Button", |
88 |
"umc/widgets/Button", |
87 |
"umc/widgets/Text", |
89 |
"umc/widgets/Text", |
Lines 91-97
define([
|
Link Here
|
---|
|
91 |
Evented, Deferred, all, cookie, topic, ioQuery, Memory, Observable, |
93 |
Evented, Deferred, all, cookie, topic, ioQuery, Memory, Observable, |
92 |
dom, domAttr, domClass, domGeometry, domConstruct, style, put, hash, styles, entities, gfx, registry, tools, login, dialog, NotificationDropDownButton, NotificationSnackbar, store, |
94 |
dom, domAttr, domClass, domGeometry, domConstruct, style, put, hash, styles, entities, gfx, registry, tools, login, dialog, NotificationDropDownButton, NotificationSnackbar, store, |
93 |
_WidgetBase, Menu, MenuItem, PopupMenuItem, MenuSeparator, Tooltip, DropDownButton, StackContainer, menu, MenuButton, |
95 |
_WidgetBase, Menu, MenuItem, PopupMenuItem, MenuSeparator, Tooltip, DropDownButton, StackContainer, menu, MenuButton, |
94 |
TabController, LiveSearch, GalleryPane, ContainerWidget, Page, Form, Button, Text, _ |
96 |
TabController, LiveSearch, GalleryPane, ContainerWidget, Page, PasswordBox, PasswordInputBox, Form, Button, Text, _ |
95 |
) { |
97 |
) { |
96 |
// cache UCR variables |
98 |
// cache UCR variables |
97 |
var _favoritesDisabled = false; |
99 |
var _favoritesDisabled = false; |
Lines 1075-1081
define([
|
Link Here
|
---|
|
1075 |
} |
1077 |
} |
1076 |
|
1078 |
|
1077 |
if (!launchableModules.length) { |
1079 |
if (!launchableModules.length) { |
1078 |
dialog.alert(_('There is no module available for the authenticated user %s.', tools.status('username'))); |
1080 |
this._showPasswordChangeDialog(); |
1079 |
} else if (launchableModules.length === 1) { |
1081 |
} else if (launchableModules.length === 1) { |
1080 |
// if only one module exists open it |
1082 |
// if only one module exists open it |
1081 |
var module = launchableModules[0]; |
1083 |
var module = launchableModules[0]; |
Lines 1085-1091
define([
|
Link Here
|
---|
|
1085 |
this.openModule(autoStartModule, autoStartFlavor, props); |
1087 |
this.openModule(autoStartModule, autoStartFlavor, props); |
1086 |
} |
1088 |
} |
1087 |
}, |
1089 |
}, |
1088 |
|
|
|
1089 |
setupGui: function() { |
1090 |
setupGui: function() { |
1090 |
// make sure that we have not build the GUI before |
1091 |
// make sure that we have not build the GUI before |
1091 |
if (tools.status('setupGui')) { |
1092 |
if (tools.status('setupGui')) { |
Lines 1099-1110
define([
|
Link Here
|
---|
|
1099 |
this._header.setupGui(); |
1100 |
this._header.setupGui(); |
1100 |
this._setupOverviewPage(); |
1101 |
this._setupOverviewPage(); |
1101 |
this._setupStateHashing(); |
1102 |
this._setupStateHashing(); |
|
|
1103 |
this._setupPasswordMenu(); |
1102 |
|
1104 |
|
1103 |
// set a flag that GUI has been build up |
1105 |
// set a flag that GUI has been build up |
1104 |
tools.status('setupGui', true); |
1106 |
tools.status('setupGui', true); |
1105 |
this.onGuiDone(); |
1107 |
this.onGuiDone(); |
1106 |
}, |
1108 |
}, |
1107 |
|
1109 |
|
|
|
1110 |
_showPasswordChangeDialog: function() { |
1111 |
var setPassword = function(values) { |
1112 |
tools.umcpCommand('set', { |
1113 |
password: values |
1114 |
}, false).then(lang.hitch(this, function() { |
1115 |
dialog.alert(_('The password has been changed successfully.')); |
1116 |
}), lang.hitch(this, function(err) { |
1117 |
err = tools.parseError(err); |
1118 |
dialog.confirm(err.message, [{ |
1119 |
label: _('OK'), |
1120 |
'default': true |
1121 |
}], _('Error changing password')).then(showPasswordChangeDialog); |
1122 |
})); |
1123 |
}; |
1124 |
menu.close(); |
1125 |
dialog.confirmForm({ |
1126 |
widgets: [{ |
1127 |
type: Text, |
1128 |
name: 'text', |
1129 |
content: _('Change the password of user "%s":', tools.status('username')) |
1130 |
}, { |
1131 |
name: 'password', |
1132 |
type: PasswordBox, |
1133 |
label: _('Old password') |
1134 |
}, { |
1135 |
name: 'new_password', |
1136 |
type: PasswordInputBox, |
1137 |
twoRows: true, |
1138 |
label: _('New password') |
1139 |
}], |
1140 |
title: _('Change password'), |
1141 |
submit: _('Change password'), |
1142 |
}).then(setPassword, function() {}); |
1143 |
}, |
1144 |
|
1145 |
_setupPasswordMenu: function() { |
1146 |
var entry = menu.addEntry({ |
1147 |
id: 'umcMenuChangePassword', |
1148 |
parentMenuId: 'umcMenuUserSettings', |
1149 |
label: _('Change password'), |
1150 |
onClick: function() { |
1151 |
topic.publish('/umc/actions', 'menu', 'passwordchange'); |
1152 |
this._showPasswordChangeDialog(); |
1153 |
} |
1154 |
}); |
1155 |
menu.hideEntry(entry); |
1156 |
|
1157 |
login.onLogin(function() { |
1158 |
// user has logged in -> show menu entry |
1159 |
menu.showEntry(entry); |
1160 |
}); |
1161 |
|
1162 |
login.onLogout(function() { |
1163 |
// user has logged out -> hide menu entry |
1164 |
menu.hideEntry(entry); |
1165 |
}); |
1166 |
}, |
1167 |
|
1108 |
// return the index for the given module tab, i.e., the index regarding other |
1168 |
// return the index for the given module tab, i.e., the index regarding other |
1109 |
// open tabs if the same module ID and flavor |
1169 |
// open tabs if the same module ID and flavor |
1110 |
_getModuleTabIndex: function(tab) { |
1170 |
_getModuleTabIndex: function(tab) { |