Browse Source

Set inputType as password

pull/2229/head
mxb 6 years ago
parent
commit
e3542d411d
  1. 721
      app/view/preferences/Preferences.js

721
app/view/preferences/Preferences.js

@ -1,370 +1,371 @@
Ext.define('Rambox.view.preferences.Preferences',{ Ext.define('Rambox.view.preferences.Preferences',{
extend: 'Ext.window.Window' extend: 'Ext.window.Window'
,xtype: 'preferences' ,xtype: 'preferences'
,requires: [ ,requires: [
'Rambox.view.preferences.PreferencesController' 'Rambox.view.preferences.PreferencesController'
,'Rambox.view.preferences.PreferencesModel' ,'Rambox.view.preferences.PreferencesModel'
,'Ext.form.field.ComboBox' ,'Ext.form.field.ComboBox'
,'Ext.form.field.Checkbox' ,'Ext.form.field.Checkbox'
] ]
,controller: 'preferences-preferences' ,controller: 'preferences-preferences'
,viewModel: { ,viewModel: {
type: 'preferences-preferences' type: 'preferences-preferences'
} }
,title: locale['preferences[0]'] ,title: locale['preferences[0]']
,width: 420 ,width: 420
,height: 500 ,height: 500
,modal: true ,modal: true
,closable: true ,closable: true
,minimizable: false ,minimizable: false
,maximizable: false ,maximizable: false
,draggable: true ,draggable: true
,resizable: false ,resizable: false
,scrollable: 'vertical' ,scrollable: 'vertical'
,bodyStyle: 'margin-right:15px;' ,bodyStyle: 'margin-right:15px;'
,buttons: [ ,buttons: [
{ {
text: locale['button[1]'] text: locale['button[1]']
,ui: 'decline' ,ui: 'decline'
,handler: 'cancel' ,handler: 'cancel'
} }
,'->' ,'->'
,{ ,{
text: locale['button[4]'] text: locale['button[4]']
,handler: 'save' ,handler: 'save'
} }
] ]
,initComponent: function() { ,initComponent: function() {
var config = ipc.sendSync('getConfig'); var config = ipc.sendSync('getConfig');
var defaultServiceOptions = []; var defaultServiceOptions = [];
defaultServiceOptions.push({ value: 'ramboxTab', label: 'Rambox Tab' }); defaultServiceOptions.push({ value: 'ramboxTab', label: 'Rambox Tab' });
defaultServiceOptions.push({ value: 'last', label: 'Last Active Service' }); defaultServiceOptions.push({ value: 'last', label: 'Last Active Service' });
Ext.getStore('Services').each(function(rec) { Ext.getStore('Services').each(function(rec) {
defaultServiceOptions.push({ defaultServiceOptions.push({
value: rec.get('id') value: rec.get('id')
,label: rec.get('name') ,label: rec.get('name')
}); });
}); });
this.items = [ this.items = [
{ {
xtype: 'form' xtype: 'form'
,bodyPadding: 20 ,bodyPadding: 20
,items: [ ,items: [
{ {
xtype: 'container' xtype: 'container'
,layout: 'hbox' ,layout: 'hbox'
,items: [ ,items: [
{ {
xtype: 'combo' xtype: 'combo'
,name: 'locale' ,name: 'locale'
,fieldLabel: 'Language' ,fieldLabel: 'Language'
,labelAlign: 'left' ,labelAlign: 'left'
,flex: 1 ,flex: 1
,labelWidth: 80 ,labelWidth: 80
,value: config.locale ,value: config.locale
,displayField: 'label' ,displayField: 'label'
,valueField: 'value' ,valueField: 'value'
,editable: false ,editable: false
,store: Ext.create('Ext.data.Store', { ,store: Ext.create('Ext.data.Store', {
fields: ['value', 'label'] fields: ['value', 'label']
,data: [ ,data: [
{ 'value': 'af', 'auth0': 'af', 'label': 'Afrikaans' } { 'value': 'af', 'auth0': 'af', 'label': 'Afrikaans' }
,{ 'value': 'ar', 'auth0': 'en', 'label': 'Arabic' } ,{ 'value': 'ar', 'auth0': 'en', 'label': 'Arabic' }
,{ 'value': 'bs2', 'auth0': 'en', 'label': 'Barndutsch, Switzerland' } ,{ 'value': 'bs2', 'auth0': 'en', 'label': 'Barndutsch, Switzerland' }
,{ 'value': 'bn', 'auth0': 'en', 'label': 'Bengali' } ,{ 'value': 'bn', 'auth0': 'en', 'label': 'Bengali' }
,{ 'value': 'bg', 'auth0': 'en', 'label': 'Bulgarian' } ,{ 'value': 'bg', 'auth0': 'en', 'label': 'Bulgarian' }
,{ 'value': 'ca', 'auth0': 'ca', 'label': 'Catalan' } ,{ 'value': 'ca', 'auth0': 'ca', 'label': 'Catalan' }
,{ 'value': 'zh-CN', 'auth0': 'zh', 'label': 'Chinese Simplified' } ,{ 'value': 'zh-CN', 'auth0': 'zh', 'label': 'Chinese Simplified' }
,{ 'value': 'zh-TW', 'auth0': 'zh-tw', 'label': 'Chinese Traditional' } ,{ 'value': 'zh-TW', 'auth0': 'zh-tw', 'label': 'Chinese Traditional' }
,{ 'value': 'hr', 'auth0': 'en', 'label': 'Croatian' } ,{ 'value': 'hr', 'auth0': 'en', 'label': 'Croatian' }
,{ 'value': 'cs', 'auth0': 'cs', 'label': 'Czech' } ,{ 'value': 'cs', 'auth0': 'cs', 'label': 'Czech' }
,{ 'value': 'da', 'auth0': 'da', 'label': 'Danish' } ,{ 'value': 'da', 'auth0': 'da', 'label': 'Danish' }
,{ 'value': 'nl', 'auth0': 'nl', 'label': 'Dutch' } ,{ 'value': 'nl', 'auth0': 'nl', 'label': 'Dutch' }
,{ 'value': 'en', 'auth0': 'en', 'label': 'English' } ,{ 'value': 'en', 'auth0': 'en', 'label': 'English' }
,{ 'value': 'fi', 'auth0': 'fi', 'label': 'Finnish' } ,{ 'value': 'fi', 'auth0': 'fi', 'label': 'Finnish' }
,{ 'value': 'fr', 'auth0': 'fr', 'label': 'French' } ,{ 'value': 'fr', 'auth0': 'fr', 'label': 'French' }
,{ 'value': 'de', 'auth0': 'de', 'label': 'German' } ,{ 'value': 'de', 'auth0': 'de', 'label': 'German' }
,{ 'value': 'de-CH', 'auth0': 'de', 'label': 'German, Switzerland' } ,{ 'value': 'de-CH', 'auth0': 'de', 'label': 'German, Switzerland' }
,{ 'value': 'el', 'auth0': 'en', 'label': 'Greek' } ,{ 'value': 'el', 'auth0': 'en', 'label': 'Greek' }
,{ 'value': 'he', 'auth0': 'en', 'label': 'Hebrew' } ,{ 'value': 'he', 'auth0': 'en', 'label': 'Hebrew' }
,{ 'value': 'hi', 'auth0': 'en', 'label': 'Hindi' } ,{ 'value': 'hi', 'auth0': 'en', 'label': 'Hindi' }
,{ 'value': 'hu', 'auth0': 'hu', 'label': 'Hungarian' } ,{ 'value': 'hu', 'auth0': 'hu', 'label': 'Hungarian' }
,{ 'value': 'id', 'auth0': 'en', 'label': 'Indonesian' } ,{ 'value': 'id', 'auth0': 'en', 'label': 'Indonesian' }
,{ 'value': 'it', 'auth0': 'it', 'label': 'Italian' } ,{ 'value': 'it', 'auth0': 'it', 'label': 'Italian' }
,{ 'value': 'ja', 'auth0': 'ja', 'label': 'Japanese' } ,{ 'value': 'ja', 'auth0': 'ja', 'label': 'Japanese' }
,{ 'value': 'ko', 'auth0': 'ko', 'label': 'Korean' } ,{ 'value': 'ko', 'auth0': 'ko', 'label': 'Korean' }
,{ 'value': 'no', 'auth0': 'no', 'label': 'Norwegian' } ,{ 'value': 'no', 'auth0': 'no', 'label': 'Norwegian' }
,{ 'value': 'fa', 'auth0': 'fa', 'label': 'Persian' } ,{ 'value': 'fa', 'auth0': 'fa', 'label': 'Persian' }
,{ 'value': 'pl', 'auth0': 'pl', 'label': 'Polish' } ,{ 'value': 'pl', 'auth0': 'pl', 'label': 'Polish' }
,{ 'value': 'pt-PT', 'auth0': 'pt-br', 'label': 'Portuguese' } ,{ 'value': 'pt-PT', 'auth0': 'pt-br', 'label': 'Portuguese' }
,{ 'value': 'pt-BR', 'auth0': 'pt-br', 'label': 'Portuguese (Brazilian)' } ,{ 'value': 'pt-BR', 'auth0': 'pt-br', 'label': 'Portuguese (Brazilian)' }
,{ 'value': 'ro', 'auth0': 'ro', 'label': 'Romanian' } ,{ 'value': 'ro', 'auth0': 'ro', 'label': 'Romanian' }
,{ 'value': 'ru', 'auth0': 'ru', 'label': 'Russian' } ,{ 'value': 'ru', 'auth0': 'ru', 'label': 'Russian' }
,{ 'value': 'sr', 'auth0': 'en', 'label': 'Serbian (Cyrillic)' } ,{ 'value': 'sr', 'auth0': 'en', 'label': 'Serbian (Cyrillic)' }
,{ 'value': 'sk', 'auth0': 'sk', 'label': 'Slovak' } ,{ 'value': 'sk', 'auth0': 'sk', 'label': 'Slovak' }
,{ 'value': 'es-ES', 'auth0': 'es', 'label': 'Spanish' } ,{ 'value': 'es-ES', 'auth0': 'es', 'label': 'Spanish' }
,{ 'value': 'sv-SE', 'auth0': 'sv', 'label': 'Swedish' } ,{ 'value': 'sv-SE', 'auth0': 'sv', 'label': 'Swedish' }
,{ 'value': 'tr', 'auth0': 'tr', 'label': 'Turkish' } ,{ 'value': 'tr', 'auth0': 'tr', 'label': 'Turkish' }
,{ 'value': 'uk', 'auth0': 'en', 'label': 'Ukrainian' } ,{ 'value': 'uk', 'auth0': 'en', 'label': 'Ukrainian' }
,{ 'value': 'vi', 'auth0': 'en', 'label': 'Vietnamese' } ,{ 'value': 'vi', 'auth0': 'en', 'label': 'Vietnamese' }
] ]
}) })
} }
,{ ,{
xtype: 'button' xtype: 'button'
,text: 'Help us Translate' ,text: 'Help us Translate'
,style: 'border-top-left-radius:0;border-bottom-left-radius:0;' ,style: 'border-top-left-radius:0;border-bottom-left-radius:0;'
,href: 'https://crowdin.com/project/rambox/invite' ,href: 'https://crowdin.com/project/rambox/invite'
} }
] ]
} }
,{ ,{
xtype: 'label' xtype: 'label'
,text: 'English is the only language that has full translation. We are working with all the others, help us!' ,text: 'English is the only language that has full translation. We are working with all the others, help us!'
,style: 'display:block;font-size:10px;line-height:15px;' ,style: 'display:block;font-size:10px;line-height:15px;'
,margin: '0 0 10 0' ,margin: '0 0 10 0'
} }
,{ ,{
xtype: 'checkbox'
,name: 'auto_launch'
,boxLabel: locale['preferences[5]']
,value: config.auto_launch
}
,{
xtype: 'checkbox'
,name: 'start_minimized'
,boxLabel: locale['preferences[4]']
,value: config.start_minimized
}
,{
xtype: 'checkbox'
,name: 'hide_menu_bar'
,boxLabel: locale['preferences[1]']+' (<code>Alt</code> key to display)'
,value: config.hide_menu_bar
,hidden: process.platform === 'darwin'
}
,{
xtype: 'combo'
,name: 'tabbar_location'
,fieldLabel: locale['preferences[11]']
,labelAlign: 'left'
,width: 380
,labelWidth: 180
,value: config.tabbar_location
,displayField: 'label'
,valueField: 'value'
,editable: false
,store: Ext.create('Ext.data.Store', {
fields: ['value', 'label']
,data: [
{ 'value': 'top', 'label': 'Top' }
,{ 'value': 'left', 'label': 'Left' }
,{ 'value': 'bottom', 'label': 'Bottom' }
,{ 'value': 'right', 'label': 'Right' }
]
})
}
,{
xtype: 'checkbox' xtype: 'checkbox'
,name: 'hide_tabbar_labels' ,name: 'auto_launch'
,boxLabel: locale['preferences[28]'] ,boxLabel: locale['preferences[5]']
,value: config.hide_tabbar_labels ,value: config.auto_launch
} }
,{ ,{
xtype: 'combo' xtype: 'checkbox'
,name: 'default_service' ,name: 'start_minimized'
,fieldLabel: locale['preferences[12]'] ,boxLabel: locale['preferences[4]']
,labelAlign: 'top' ,value: config.start_minimized
//,width: 380 }
//,labelWidth: 105 ,{
,value: config.default_service xtype: 'checkbox'
,displayField: 'label' ,name: 'hide_menu_bar'
,valueField: 'value' ,boxLabel: locale['preferences[1]']+' (<code>Alt</code> key to display)'
,editable: false ,value: config.hide_menu_bar
,store: Ext.create('Ext.data.Store', { ,hidden: process.platform === 'darwin'
fields: ['value', 'label'] }
,data: defaultServiceOptions ,{
}) xtype: 'combo'
} ,name: 'tabbar_location'
,{ ,fieldLabel: locale['preferences[11]']
xtype: 'combo' ,labelAlign: 'left'
,name: 'window_display_behavior' ,width: 380
,fieldLabel: locale['preferences[13]'] ,labelWidth: 180
,labelAlign: 'left' ,value: config.tabbar_location
,width: 380 ,displayField: 'label'
,labelWidth: 105 ,valueField: 'value'
,value: config.window_display_behavior ,editable: false
,displayField: 'label' ,store: Ext.create('Ext.data.Store', {
,valueField: 'value' fields: ['value', 'label']
,editable: false ,data: [
,store: Ext.create('Ext.data.Store', { { 'value': 'top', 'label': 'Top' }
fields: ['value', 'label'] ,{ 'value': 'left', 'label': 'Left' }
,data: [ ,{ 'value': 'bottom', 'label': 'Bottom' }
{ 'value': 'show_taskbar', 'label': locale['preferences[14]'] } ,{ 'value': 'right', 'label': 'Right' }
,{ 'value': 'show_trayIcon', 'label': locale['preferences[15]'] } ]
,{ 'value': 'taskbar_tray', 'label': locale['preferences[16]'] } })
] }
}) ,{
,hidden: process.platform === 'darwin' xtype: 'checkbox'
} ,name: 'hide_tabbar_labels'
,{ ,boxLabel: locale['preferences[28]']
xtype: 'combo' ,value: config.hide_tabbar_labels
,name: 'window_close_behavior' }
,fieldLabel: locale['preferences[17]'] ,{
,labelAlign: 'left' xtype: 'combo'
,width: 380 ,name: 'default_service'
,labelWidth: 180 ,fieldLabel: locale['preferences[12]']
,value: config.window_close_behavior ,labelAlign: 'top'
,displayField: 'label' //,width: 380
,valueField: 'value' //,labelWidth: 105
,editable: false ,value: config.default_service
,store: Ext.create('Ext.data.Store', { ,displayField: 'label'
fields: ['value', 'label'] ,valueField: 'value'
,data: [ ,editable: false
{ 'value': 'keep_in_tray', 'label': locale['preferences[18]'] } ,store: Ext.create('Ext.data.Store', {
,{ 'value': 'keep_in_tray_and_taskbar', 'label': locale['preferences[19]'] } fields: ['value', 'label']
,{ 'value': 'quit', 'label': locale['preferences[20]'] } ,data: defaultServiceOptions
] })
}) }
,hidden: process.platform === 'darwin' ,{
} xtype: 'combo'
,{ ,name: 'window_display_behavior'
xtype: 'checkbox' ,fieldLabel: locale['preferences[13]']
,name: 'always_on_top' ,labelAlign: 'left'
,boxLabel: locale['preferences[21]'] ,width: 380
,value: config.always_on_top ,labelWidth: 105
} ,value: config.window_display_behavior
,{ ,displayField: 'label'
xtype: 'checkbox' ,valueField: 'value'
,name: 'systemtray_indicator' ,editable: false
,boxLabel: locale['preferences[22]'] ,store: Ext.create('Ext.data.Store', {
,value: config.systemtray_indicator fields: ['value', 'label']
,hidden: process.platform === 'darwin' ,data: [
} { 'value': 'show_taskbar', 'label': locale['preferences[14]'] }
,{ ,{ 'value': 'show_trayIcon', 'label': locale['preferences[15]'] }
xtype: 'checkbox' ,{ 'value': 'taskbar_tray', 'label': locale['preferences[16]'] }
,name: 'flash_frame' ]
,boxLabel: process.platform === 'darwin' ? locale['preferences[10]'] : locale['preferences[9]'] })
,value: config.flash_frame ,hidden: process.platform === 'darwin'
} }
,{ ,{
xtype: 'checkbox' xtype: 'combo'
,name: 'disable_gpu' ,name: 'window_close_behavior'
,boxLabel: locale['preferences[23]'] ,fieldLabel: locale['preferences[17]']
,value: config.disable_gpu ,labelAlign: 'left'
} ,width: 380
,{ ,labelWidth: 180
xtype: 'checkbox' ,value: config.window_close_behavior
,name: 'enable_hidpi_support' ,displayField: 'label'
,boxLabel: locale['preferences[8]'] ,valueField: 'value'
,value: config.enable_hidpi_support ,editable: false
,hidden: process.platform !== 'win32' ,store: Ext.create('Ext.data.Store', {
}, fields: ['value', 'label']
{ ,data: [
xtype: 'textfield' { 'value': 'keep_in_tray', 'label': locale['preferences[18]'] }
,fieldLabel: 'Override User-Agent for all services (needs to relaunch)' ,{ 'value': 'keep_in_tray_and_taskbar', 'label': locale['preferences[19]'] }
,labelAlign: 'top' ,{ 'value': 'quit', 'label': locale['preferences[20]'] }
,name: 'user_agent' ]
,value: config.user_agent })
,width: 360 ,hidden: process.platform === 'darwin'
,emptyText: 'Leave blank for default user agent' }
} ,{
,{ xtype: 'checkbox'
xtype: 'fieldset' ,name: 'always_on_top'
,title: locale['preferences[24]'] ,boxLabel: locale['preferences[21]']
,collapsed: !config.master_password ,value: config.always_on_top
,checkboxToggle: true }
,checkboxName: 'master_password' ,{
,margin: '10 0 0 0' xtype: 'checkbox'
,padding: 10 ,name: 'systemtray_indicator'
,layout: 'hbox' ,boxLabel: locale['preferences[22]']
,defaults: { labelAlign: 'top' } ,value: config.systemtray_indicator
,items: [ ,hidden: process.platform === 'darwin'
{ }
xtype: 'textfield' ,{
,inputType: 'password' xtype: 'checkbox'
,fieldLabel: locale['preferences[25]'] ,name: 'flash_frame'
,name: 'master_password1' ,boxLabel: process.platform === 'darwin' ? locale['preferences[10]'] : locale['preferences[9]']
,itemId: 'pass' ,value: config.flash_frame
,flex: 1 }
,listeners: { ,{
validitychange: function(field) { xtype: 'checkbox'
field.next().validate(); ,name: 'disable_gpu'
}, ,boxLabel: locale['preferences[23]']
blur: function(field) { ,value: config.disable_gpu
field.next().validate(); }
} ,{
} xtype: 'checkbox'
} ,name: 'enable_hidpi_support'
,{ ,boxLabel: locale['preferences[8]']
xtype: 'textfield' ,value: config.enable_hidpi_support
,inputType: 'password' ,hidden: process.platform !== 'win32'
,fieldLabel: locale['preferences[26]'] },
,name: 'master_password2' {
,margin: '0 0 0 10' xtype: 'textfield'
,vtype: 'password' ,fieldLabel: 'Override User-Agent for all services (needs to relaunch)'
,initialPassField: 'pass' ,labelAlign: 'top'
,flex: 1 ,name: 'user_agent'
} ,value: config.user_agent
] ,width: 360
} ,emptyText: 'Leave blank for default user agent'
,{ }
xtype: 'fieldset' ,{
,title: 'Proxy (needs to relaunch) - <a href="https://github.com/saenzramiro/rambox/wiki/FREE-PROXY-SERVERS" target="_blank">Free Proxy Servers</a>' xtype: 'fieldset'
,collapsed: !config.proxy ,title: locale['preferences[24]']
,checkboxToggle: true ,collapsed: !config.master_password
,checkboxName: 'proxy' ,checkboxToggle: true
,margin: '10 0 0 0' ,checkboxName: 'master_password'
,padding: 10 ,margin: '10 0 0 0'
,layout: 'vbox' ,padding: 10
,defaults: { labelAlign: 'left' } ,layout: 'hbox'
,items: [ ,defaults: { labelAlign: 'top' }
{ ,items: [
xtype: 'textfield' {
,vtype: 'url' xtype: 'textfield'
,fieldLabel: 'Host' ,inputType: 'password'
,name: 'proxyHost' ,fieldLabel: locale['preferences[25]']
,value: config.proxyHost ,name: 'master_password1'
//,flex: 1 ,itemId: 'pass'
} ,flex: 1
,{ ,listeners: {
xtype: 'numberfield' validitychange: function(field) {
,fieldLabel: 'Port' field.next().validate();
,name: 'proxyPort' },
,value: config.proxyPort blur: function(field) {
} field.next().validate();
,{ }
xtype: 'textfield' }
,fieldLabel: 'Login' }
,name: 'proxyLogin' ,{
,value: config.proxyLogin xtype: 'textfield'
,emptyText: 'Optional' ,inputType: 'password'
} ,fieldLabel: locale['preferences[26]']
,{ ,name: 'master_password2'
xtype: 'textfield' ,margin: '0 0 0 10'
,fieldLabel: 'Password' ,vtype: 'password'
,name: 'proxyPassword' ,initialPassField: 'pass'
,value: config.proxyPassword ,flex: 1
,emptyText: 'Optional' }
} ]
] }
} ,{
,{ xtype: 'fieldset'
xtype: 'checkbox' ,title: 'Proxy (needs to relaunch) - <a href="https://github.com/saenzramiro/rambox/wiki/FREE-PROXY-SERVERS" target="_blank">Free Proxy Servers</a>'
,name: 'sendStatistics' ,collapsed: !config.proxy
,boxLabel: locale['preferences[27]'] ,checkboxToggle: true
,value: config.sendStatistics ,checkboxName: 'proxy'
} ,margin: '10 0 0 0'
] ,padding: 10
} ,layout: 'vbox'
]; ,defaults: { labelAlign: 'left' }
,items: [
{
xtype: 'textfield'
,vtype: 'url'
,fieldLabel: 'Host'
,name: 'proxyHost'
,value: config.proxyHost
//,flex: 1
}
,{
xtype: 'numberfield'
,fieldLabel: 'Port'
,name: 'proxyPort'
,value: config.proxyPort
}
,{
xtype: 'textfield'
,fieldLabel: 'Login'
,name: 'proxyLogin'
,value: config.proxyLogin
,emptyText: 'Optional'
}
,{
xtype: 'textfield'
,fieldLabel: 'Password'
,name: 'proxyPassword'
,value: config.proxyPassword
,emptyText: 'Optional'
,inputType: 'password'
}
]
}
,{
xtype: 'checkbox'
,name: 'sendStatistics'
,boxLabel: locale['preferences[27]']
,value: config.sendStatistics
}
]
}
];
this.callParent(); this.callParent();
} }
}); });

Loading…
Cancel
Save