Fixing authentication cancel with null/undefined credentials.
This commit is contained in:
parent
7549adcfce
commit
7f8b180f70
2 changed files with 21 additions and 3 deletions
|
@ -305,8 +305,7 @@ void URLRequest::OnAuthenticationRequired(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitRequestEvent(
|
Emit("login", auth_info.get(),
|
||||||
false, "login", auth_info.get(),
|
|
||||||
base::Bind(&AtomURLRequest::PassLoginInformation, atom_request_));
|
base::Bind(&AtomURLRequest::PassLoginInformation, atom_request_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -192,6 +192,25 @@ class ClientRequest extends EventEmitter {
|
||||||
this.emit('response', response)
|
this.emit('response', response)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
urlRequest.on('login', (event, authInfo, callback) => {
|
||||||
|
this.emit('login', authInfo, (username, password) => {
|
||||||
|
// If null or undefined usrename/password, force to empty string.
|
||||||
|
if (username === null || username === undefined) {
|
||||||
|
username = ''
|
||||||
|
}
|
||||||
|
if (typeof username !== 'string') {
|
||||||
|
throw new Error('username must be a string')
|
||||||
|
}
|
||||||
|
if (password === null || password === undefined) {
|
||||||
|
password = ''
|
||||||
|
}
|
||||||
|
if (typeof password !== 'string') {
|
||||||
|
throw new Error('password must be a string')
|
||||||
|
}
|
||||||
|
callback(username, password)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
this.once('response', callback)
|
this.once('response', callback)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue