Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 8314b33

Browse files
authored
Merge pull request #1854 from rmisio/no-local-auth
Handling the server removing local authentication
2 parents be5b0b5 + 3c73f44 commit 8314b33

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

js/templates/serverConfigForm.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</div>
2626

2727
<div class="flexCol-8 borderRight0 custCol-border <% ob.errors.name && print('invalid') %>">
28-
<input name="name" type="text" id="fld_name" class="fieldItem" value="<%= ob.name %>">
28+
<input name="name" type="text" id="fld_name" class="fieldItem <% if (ob.default) print('disabled') %>" value="<%= ob.name %>">
2929
</div>
3030
</div>
3131

@@ -47,14 +47,15 @@
4747
</div>
4848

4949
<div class="flexCol-3 borderRight0 custCol-border <% ob.errors.server_ip && print('invalid') %>">
50-
<input name="server_ip" type="text" id="fld_server" placeholder="" class="fieldItem" required="" value="<%= ob.server_ip %>">
50+
<input name="server_ip" type="text" id="fld_server" placeholder="" class="fieldItem <% if (ob.default) print('disabled') %>" required="" value="<%= ob.server_ip %>">
5151
</div>
52-
<div class="flexCol-5 sslSwitch-radio ustCol-border <% ob.errors.server_ip && print('invalid') %>">
52+
<div class="flexCol-5 sslSwitch-radio ustCol-border <% ob.errors.server_ip && print('invalid') %> <% if (ob.default) print('disabled') %>">
5353
<input type="radio" class="fieldItem" id="js-sslOn" name="sslSwitch" value="true" <% if(ob.SSL) { print("checked") } %> /><label for="js-sslOn" class="radioLabel"><%= polyglot.t('SSLOn') %></label>
5454
<input type="radio" class="fieldItem" id="js-sslOff" name="sslSwitch" value="false" <% if(!ob.SSL) { print("checked") } %>/><label for="js-sslOff" class="radioLabel"><%= polyglot.t('SSLOff') %></label>
5555

5656
</div>
5757
</div>
58+
<% if (!ob.isLocal) { %>
5859
<div class="flexRow">
5960
<% if (ob.errors.username) { %>
6061
<div class="flexCol-12">
@@ -73,7 +74,7 @@
7374
</div>
7475

7576
<div class="flexCol-8 borderRight0 custCol-border <% ob.errors.username && print('invalid') %>">
76-
<input name="username" type="text" id="fld_username" class="fieldItem" value="<%= ob.username %>">
77+
<input name="username" type="text" id="fld_username" class="fieldItem <% if (ob.default) print('disabled') %>" value="<%= ob.username %>">
7778
</div>
7879
</div>
7980

@@ -95,9 +96,10 @@
9596
</div>
9697

9798
<div class="flexCol-8 borderRight0 custCol-border <% ob.errors.password && print('invalid') %>">
98-
<input name="password" type="password" id="fld_password" class="fieldItem" value="<%= ob.password %>">
99+
<input name="password" type="password" id="fld_password" class="fieldItem <% if (ob.default) print('disabled') %>" value="<%= ob.password %>">
99100
</div>
100101
</div>
102+
<% } %>
101103

102104
<div class="flexRow">
103105
<% if (ob.errors.rest_api_port) { %>
@@ -117,7 +119,7 @@
117119
</div>
118120

119121
<div class="flexCol-8 borderRight0 custCol-border <% ob.errors.rest_api_port && print('invalid') %>">
120-
<input name="rest_api_port" type="text" id="fld_rest_port" placeholder="" class="fieldItem" value="<%= ob.rest_api_port %>">
122+
<input name="rest_api_port" type="text" id="fld_rest_port" placeholder="" class="fieldItem <% if (ob.default) print('disabled') %>" value="<%= ob.rest_api_port %>">
121123
</div>
122124
</div>
123125

@@ -139,7 +141,7 @@
139141
</div>
140142

141143
<div class="flexCol-8 borderRight0 custCol-border <% ob.errors.api_socket_port && print('invalid') %>">
142-
<input name="api_socket_port" type="text" id="fld_api_socket_port" placeholder="" class="fieldItem" value="<%= ob.api_socket_port %>">
144+
<input name="api_socket_port" type="text" id="fld_api_socket_port" placeholder="" class="fieldItem <% if (ob.default) print('disabled') %>" value="<%= ob.api_socket_port %>">
143145
</div>
144146
</div>
145147

@@ -161,7 +163,7 @@
161163
</div>
162164

163165
<div class="flexCol-8 borderRight0 custCol-border <% ob.errors.heartbeat_socket_port && print('invalid') %>">
164-
<input name="heartbeat_socket_port" type="text" id="fld_heartbeat_socket_port" placeholder="" class="fieldItem" value="<%= ob.heartbeat_socket_port %>">
166+
<input name="heartbeat_socket_port" type="text" id="fld_heartbeat_socket_port" placeholder="" class="fieldItem <% if (ob.default) print('disabled') %>" value="<%= ob.heartbeat_socket_port %>">
165167
</div>
166168
</div>
167169

@@ -174,7 +176,7 @@
174176
<span class="fontSize10 marginRight2"></span>
175177
<%= polyglot.t('Cancel') %>
176178
</a>
177-
<a class="btn btn-bar btn-half js-save color-secondary custCol-secondary textOpacity90 custCol-border-primary custCol-text" tabindex="0">
179+
<a class="btn btn-bar btn-half js-save color-secondary custCol-secondary textOpacity90 custCol-border-primary custCol-text <% if (ob.default) print('disabled') %>" tabindex="0">
178180
<span class="ion-checkmark fontSize10 marginRight2 textOpacity50"></span>
179181
<%= polyglot.t('serverConnectModal.saveChanges') %>
180182
</a>

js/templates/serverConfigRow.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
<a class="btn btn-txt btn-secondary custCol-secondary pull-right fontSize13 marginLeft5 js-connect">
1414
<% print(ob.status === 'not-connected' ? polyglot.t('serverConnectModal.connect') : polyglot.t('Retry')) %>
1515
</a>
16-
<% if (!ob.default) { %>
1716
<a class="btn btn-txt btn-secondary custCol-secondary pull-right marginLeft5 positionWrapper js-edit-config tooltip tooltip-leftTop" data-tooltip="Edit Configuration">
1817
<span class="ion-ios-gear textOpacity1 fullCentered"></span>
1918
</a>
19+
<% if (!ob.default) { %>
2020
<a class="btn btn-txt btn-secondary custCol-secondary pull-right fontSize13 positionWrapper js-delete-config tooltip tooltip-leftTop" data-tooltip="Delete Configuration">
2121
<span class="ion-ios-trash textOpacity1 fullCentered"></span>
2222
</a>

js/views/serverConfigFormVw.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = BaseVw.extend({
2828
},
2929

3030
processKey: function(e) {
31-
if(e.which === 13) this.saveForm();
31+
if (e.which === 13) this.saveForm();
3232
},
3333

3434
inputEntered: function(e) {
@@ -60,7 +60,10 @@ module.exports = BaseVw.extend({
6060
render: function() {
6161
loadTemplate('./js/templates/serverConfigForm.html', (t) => {
6262
this.$el.html(
63-
t(__.extend(this.model.toJSON(), { errors: this.model.validationError || {} }))
63+
t(__.extend(this.model.toJSON(), {
64+
errors: this.model.validationError || {},
65+
isLocal: this.model.isLocalServer(),
66+
}))
6467
);
6568
});
6669

0 commit comments

Comments
 (0)