@@ -193,8 +193,8 @@ if (typeof Extras == "undefined" || !Extras)
193
193
hasToken : function OAuth_hasToken ( )
194
194
{
195
195
// TODO check that the token is valid as well as that it just exists?
196
- return this . authData . oauth_token != null && this . authData . oauth_token != "" &&
197
- this . authData . oauth_token_secret != null && this . authData . oauth_token_secret != "" ;
196
+ return this . authData . oauth_token !== null && this . authData . oauth_token != = "" &&
197
+ this . authData . oauth_token_secret !== null && this . authData . oauth_token_secret != = "" ;
198
198
} ,
199
199
200
200
/**
@@ -206,9 +206,9 @@ if (typeof Extras == "undefined" || !Extras)
206
206
isAuthorized : function OAuth_isAuthorized ( )
207
207
{
208
208
// TODO check that the token is valid as well as that it just exists?
209
- return this . authData . oauth_token != null && this . authData . oauth_token != "" &&
210
- this . authData . oauth_token_secret != null && this . authData . oauth_token_secret != ""
211
- && ! this . authData . oauth_callback_confirmed ;
209
+ return this . authData . oauth_token !== null && this . authData . oauth_token != = "" &&
210
+ this . authData . oauth_token_secret !== null && this . authData . oauth_token_secret !== "" &&
211
+ ! this . authData . oauth_callback_confirmed ;
212
212
} ,
213
213
214
214
/**
@@ -224,15 +224,15 @@ if (typeof Extras == "undefined" || !Extras)
224
224
authParams = { } ;
225
225
226
226
// Add a callback if needed
227
- if ( this . options . connectorId != null && this . options . connectorId != "" )
227
+ if ( this . options . connectorId !== null && this . options . connectorId != = "" )
228
228
{
229
229
authParams . oauth_callback = window . location . protocol + "//" + window . location . host +
230
230
Alfresco . constants . URL_SERVICECONTEXT + "extras/oauth/auth-return" + "?rp=" +
231
231
window . location . pathname . replace ( Alfresco . constants . URL_CONTEXT , "" ) +
232
232
"&pid=" + this . options . providerId + "&eid=" + this . options . endpointId + "&cid=" +
233
233
this . options . connectorId ;
234
234
}
235
- else if ( this . options . requestTokenCallbackUri != null && ! authParams . oauth_callback )
235
+ else if ( this . options . requestTokenCallbackUri !== null && ! authParams . oauth_callback )
236
236
{
237
237
authParams . oauth_callback = this . options . requestTokenCallbackUri ;
238
238
}
@@ -472,10 +472,10 @@ if (typeof Extras == "undefined" || !Extras)
472
472
var successCallback = {
473
473
fn : function ( p_resp ) {
474
474
var json = p_resp . json ;
475
- if ( json != null && json . org != null )
475
+ if ( json !== null && json . org )
476
476
{
477
477
var credentials = json . org . alfresco . share . oauth [ this . options . providerId ] . data ;
478
- if ( credentials != null && credentials . length > 0 )
478
+ if ( credentials !== null && credentials . length > 0 )
479
479
{
480
480
var authData = this . _unpackAuthData ( credentials ) ;
481
481
// Ensure both required tokens have been found
@@ -634,7 +634,7 @@ if (typeof Extras == "undefined" || !Extras)
634
634
}
635
635
}
636
636
return params ;
637
- }
637
+ } ;
638
638
639
639
if ( YAHOO . lang . isObject ( obj . dataObj ) )
640
640
{
@@ -647,11 +647,11 @@ if (typeof Extras == "undefined" || !Extras)
647
647
var reqType = obj . requestContentType || Alfresco . util . Ajax . FORM ;
648
648
if ( ! YAHOO . lang . isValue ( obj . dataStr ) )
649
649
{
650
- if ( ( new RegExp ( "^\s*" + Alfresco . util . Ajax . FORM ) ) . test ( reqType ) )
650
+ if ( ( new RegExp ( "^\\ s*" + Alfresco . util . Ajax . FORM ) ) . test ( reqType ) )
651
651
{
652
652
obj . dataStr = objToParamString ( obj . dataObj , "+" ) ;
653
653
}
654
- else if ( ( new RegExp ( "^\s*" + Alfresco . util . Ajax . JSON ) ) . test ( reqType ) )
654
+ else if ( ( new RegExp ( "^\\ s*" + Alfresco . util . Ajax . JSON ) ) . test ( reqType ) )
655
655
{
656
656
obj . dataStr = YAHOO . lang . JSON . stringify ( obj . dataObj || { } ) ;
657
657
}
@@ -667,7 +667,7 @@ if (typeof Extras == "undefined" || !Extras)
667
667
o . getResponseHeader [ "content-type" ] ;
668
668
// User provided a custom successCallback
669
669
var json = null ;
670
- if ( ( new RegExp ( "^\s*" + Alfresco . util . Ajax . JSON ) ) . test ( contentType ) )
670
+ if ( ( new RegExp ( "^\\ s*" + Alfresco . util . Ajax . JSON ) ) . test ( contentType ) )
671
671
{
672
672
cbObj . json = Alfresco . util . parseJSON ( o . responseText ) ;
673
673
}
@@ -706,7 +706,8 @@ if (typeof Extras == "undefined" || !Extras)
706
706
*/
707
707
_packAuthData : function OAuth__packAuthData ( data , delimiter , quote )
708
708
{
709
- var items = [ ] , d , quote = quote || "" ;
709
+ var items = [ ] , d , k ;
710
+ quote = quote || "" ;
710
711
for ( k in data )
711
712
{
712
713
items . push ( "" + k + "=" + quote + data [ k ] + quote ) ;
@@ -773,11 +774,11 @@ if (typeof Extras == "undefined" || !Extras)
773
774
data . oauth_timestamp = Math . floor ( Date . now ( ) / 1000 ) ;
774
775
}
775
776
// Access token, if we have one and another token was not specified
776
- if ( typeof data . oauth_token == "undefined" && this . authData != null && this . authData . oauth_token != null )
777
+ if ( typeof data . oauth_token === "undefined" && this . authData !== null && this . authData . oauth_token != = null )
777
778
{
778
779
data . oauth_token = this . authData . oauth_token ;
779
780
}
780
- if ( typeof data . oauth_token_secret == "undefined" && this . authData != null && this . authData . oauth_token_secret != null )
781
+ if ( typeof data . oauth_token_secret === "undefined" && this . authData !== null && this . authData . oauth_token_secret != = null )
781
782
{
782
783
data . oauth_token_secret = this . authData . oauth_token_secret ;
783
784
}
0 commit comments