better bridge username authentication
This commit is contained in:
parent
0559e99284
commit
eefa863855
1 changed files with 10 additions and 12 deletions
|
|
@ -119,17 +119,10 @@ export default Em.Component.extend({
|
|||
contentType: 'application/json',
|
||||
type: 'POST'
|
||||
}).done((result, status)=>{
|
||||
if (status === 'success') {
|
||||
if (!result[0].error) {
|
||||
this.setProperties({
|
||||
bridgeUsername: result[0].success.username,
|
||||
bridgePingIntervalHandle: null
|
||||
});
|
||||
|
||||
this.get('storage').set('huegasm.bridgeUsername', result[0].success.username);
|
||||
clearInterval(this.get('bridgePingIntervalHandle'));
|
||||
}
|
||||
this.set('bridgeAuthenticateError', result[0].internalipaddress);
|
||||
if (status === 'success' && !result[0].error) {
|
||||
this.clearBridgePingIntervalHandle();
|
||||
this.set('bridgeUsername', result[0].success.username);
|
||||
this.get('storage').set('huegasm.bridgeUsername', result[0].success.username);
|
||||
}
|
||||
|
||||
this.set('bridgeAuthenticateReachedStatus', status);
|
||||
|
|
@ -137,10 +130,15 @@ export default Em.Component.extend({
|
|||
|
||||
this.incrementProperty('bridgeUserNamePingIntervalProgress', this.get('bridgeUsernamePingIntervalTime')/bridgeUsernamePingMaxTime*100);
|
||||
} else {
|
||||
clearInterval(this.get('bridgePingIntervalHandle'));
|
||||
this.clearBridgePingIntervalHandle();
|
||||
}
|
||||
},
|
||||
|
||||
clearBridgePingIntervalHandle(){
|
||||
clearInterval(this.get('bridgePingIntervalHandle'));
|
||||
this.set('bridgePingIntervalHandle', null);
|
||||
},
|
||||
|
||||
isAuthenticating: function(){
|
||||
return this.get('bridgePingIntervalHandle') !== null;
|
||||
}.property('bridgePingIntervalHandle')
|
||||
|
|
|
|||
Reference in a new issue