[Fix] code cleanup in strolch-wc-auth.html
This commit is contained in:
parent
23c1262554
commit
390f6a8fa9
|
@ -57,15 +57,15 @@
|
||||||
<paper-card heading="{{localize('login')}}">
|
<paper-card heading="{{localize('login')}}">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<p>{{localize('pleaseLogin', 'appTitle', appTitle)}}</p>
|
<p>{{localize('pleaseLogin', 'appTitle', appTitle)}}</p>
|
||||||
<paper-input id="username"
|
<paper-input id="usernameInput"
|
||||||
bind-value="{{username}}"
|
value="{{username}}"
|
||||||
label="{{localize('username')}}"
|
label="{{localize('username')}}"
|
||||||
required
|
required
|
||||||
autofocus="true"
|
autofocus="true"
|
||||||
auto-validate></paper-input>
|
auto-validate></paper-input>
|
||||||
|
|
||||||
<paper-input id="password"
|
<paper-input id="passwordInput"
|
||||||
bind-value="{{password}}"
|
value="{{password}}"
|
||||||
label="{{localize('password')}}"
|
label="{{localize('password')}}"
|
||||||
required
|
required
|
||||||
type="password"
|
type="password"
|
||||||
|
@ -84,14 +84,15 @@
|
||||||
<paper-card heading="{{localize('passwordReset')}}">
|
<paper-card heading="{{localize('passwordReset')}}">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<p>{{localize('passwordResetDesc')}}</p>
|
<p>{{localize('passwordResetDesc')}}</p>
|
||||||
<paper-input id="usernameReset"
|
<paper-input id="usernameResetInput"
|
||||||
bind-value="{{username}}"
|
value="{{username}}"
|
||||||
label="{{localize('username')}}"
|
label="{{localize('username')}}"
|
||||||
required
|
required
|
||||||
autofocus="true"
|
autofocus="true"
|
||||||
auto-validate></paper-input>
|
auto-validate></paper-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
|
<paper-button on-tap="_cancelReset">{{localize('cancel')}}</paper-button>
|
||||||
<paper-button on-tap="_initiateReset">{{localize('reset')}}</paper-button>
|
<paper-button on-tap="_initiateReset">{{localize('reset')}}</paper-button>
|
||||||
</div>
|
</div>
|
||||||
</paper-card>
|
</paper-card>
|
||||||
|
@ -103,7 +104,7 @@
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<p>{{localize('passwordResetInitiated')}}</p>
|
<p>{{localize('passwordResetInitiated')}}</p>
|
||||||
<p>{{localize('passwordResetCode')}}</p>
|
<p>{{localize('passwordResetCode')}}</p>
|
||||||
<paper-input id="code"
|
<paper-input id="codeInput"
|
||||||
bind-value="{{code}}"
|
bind-value="{{code}}"
|
||||||
label="{{localize('code')}}"
|
label="{{localize('code')}}"
|
||||||
required
|
required
|
||||||
|
@ -121,14 +122,14 @@
|
||||||
<paper-card heading="{{localize('passwordReset')}}">
|
<paper-card heading="{{localize('passwordReset')}}">
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<p>{{localize('passwordResetNew')}}</p>
|
<p>{{localize('passwordResetNew')}}</p>
|
||||||
<paper-input id="password1"
|
<paper-input id="password1Input"
|
||||||
bind-value="{{password1}}"
|
bind-value="{{password1}}"
|
||||||
label="{{localize('password')}}"
|
label="{{localize('password')}}"
|
||||||
required
|
required
|
||||||
type="password"
|
type="password"
|
||||||
on-focus="onFocus"
|
on-focus="onFocus"
|
||||||
auto-validate></paper-input>
|
auto-validate></paper-input>
|
||||||
<paper-input id="password2"
|
<paper-input id="password2Input"
|
||||||
bind-value="{{password2}}"
|
bind-value="{{password2}}"
|
||||||
label="{{localize('repeat')}}"
|
label="{{localize('repeat')}}"
|
||||||
required
|
required
|
||||||
|
@ -232,7 +233,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
onCloseDlg: function (evt) {
|
onCloseDlg: function (evt) {
|
||||||
this.$.username.inputElement.select();
|
this.$.usernameInput.inputElement.select();
|
||||||
},
|
},
|
||||||
|
|
||||||
reload: function () {
|
reload: function () {
|
||||||
|
@ -296,7 +297,7 @@
|
||||||
|
|
||||||
_submitForm: function () {
|
_submitForm: function () {
|
||||||
|
|
||||||
if (!this.$.username.validate() || !this.$.password.validate()) return;
|
if (!this.$.usernameInput.validate() || !this.$.passwordInput.validate()) return;
|
||||||
|
|
||||||
console.log('Authenticating...');
|
console.log('Authenticating...');
|
||||||
this._ajaxResponse = function (data) {
|
this._ajaxResponse = function (data) {
|
||||||
|
@ -333,9 +334,14 @@
|
||||||
this.$.authForm.hidden = false;
|
this.$.authForm.hidden = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_cancelReset : function() {
|
||||||
|
this._hideAll();
|
||||||
|
this.$.authForm.hidden = false;
|
||||||
|
},
|
||||||
|
|
||||||
_initiateReset: function () {
|
_initiateReset: function () {
|
||||||
|
|
||||||
if (!this.$.usernameReset.validate()) return;
|
if (!this.$.usernameResetInput.validate()) return;
|
||||||
|
|
||||||
console.log('Initiating reset...');
|
console.log('Initiating reset...');
|
||||||
|
|
||||||
|
@ -343,7 +349,7 @@
|
||||||
this._ajaxResponse = function (data) {
|
this._ajaxResponse = function (data) {
|
||||||
that._hideAll();
|
that._hideAll();
|
||||||
that.$.resetInitiated.hidden = false;
|
that.$.resetInitiated.hidden = false;
|
||||||
that.$.code.focus();
|
that.$.codeInput.focus();
|
||||||
};
|
};
|
||||||
this.dlgTitle = this.localize('resetFailed');
|
this.dlgTitle = this.localize('resetFailed');
|
||||||
|
|
||||||
|
@ -358,7 +364,7 @@
|
||||||
|
|
||||||
_validateChallenge: function () {
|
_validateChallenge: function () {
|
||||||
|
|
||||||
if (!this.$.code.validate()) return;
|
if (!this.$.codeInput.validate()) return;
|
||||||
|
|
||||||
console.log('Validating challenge...');
|
console.log('Validating challenge...');
|
||||||
|
|
||||||
|
@ -367,7 +373,7 @@
|
||||||
that.authToken = data.detail.response.authToken;
|
that.authToken = data.detail.response.authToken;
|
||||||
that._hideAll();
|
that._hideAll();
|
||||||
that.$.resetForm.hidden = false;
|
that.$.resetForm.hidden = false;
|
||||||
that.$.password1.focus();
|
that.$.password1Input.focus();
|
||||||
};
|
};
|
||||||
this.dlgTitle = this.localize('resetFailed');
|
this.dlgTitle = this.localize('resetFailed');
|
||||||
|
|
||||||
|
@ -382,11 +388,11 @@
|
||||||
|
|
||||||
_doReset: function () {
|
_doReset: function () {
|
||||||
|
|
||||||
if (!this.$.password1.validate() || !this.$.password2.validate()) return;
|
if (!this.$.password1Input.validate() || !this.$.password2Input.validate()) return;
|
||||||
|
|
||||||
if (this.password1 !== this.password2) {
|
if (this.password1 !== this.password2) {
|
||||||
this.$.password1.invalid = true;
|
this.$.password1Input.invalid = true;
|
||||||
this.$.password2.invalid = true;
|
this.$.password2Input.invalid = true;
|
||||||
var dlgTitle = this.localize('resetFailed');
|
var dlgTitle = this.localize('resetFailed');
|
||||||
var dlgText = this.localize('passwordsDontMatch');
|
var dlgText = this.localize('passwordsDontMatch');
|
||||||
this.showError(dlgTitle, dlgText);
|
this.showError(dlgTitle, dlgText);
|
||||||
|
|
Loading…
Reference in New Issue