mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Use params from epp_session.js
Use bundled params instead of passing individual arguments through epp_session.js. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=136384801
This commit is contained in:
parent
5da24fd361
commit
ebeded4c74
3 changed files with 14 additions and 23 deletions
|
@ -47,10 +47,15 @@ goog.forwardDeclare('registry.Component');
|
||||||
* @final
|
* @final
|
||||||
*/
|
*/
|
||||||
registry.registrar.Console = function(params) {
|
registry.registrar.Console = function(params) {
|
||||||
|
/**
|
||||||
|
* @type {!Object}
|
||||||
|
*/
|
||||||
|
// We have to define this before creating an EppSession because EppSession's
|
||||||
|
// constructor expects us to have it as an attribute.
|
||||||
|
this.params = params;
|
||||||
|
|
||||||
registry.registrar.Console.base(
|
registry.registrar.Console.base(
|
||||||
this, 'constructor',
|
this, 'constructor', new registry.registrar.EppSession(this));
|
||||||
new registry.registrar.EppSession(this, params.xsrfToken,
|
|
||||||
params.clientId));
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component that's currently embedded in the page.
|
* Component that's currently embedded in the page.
|
||||||
|
@ -63,11 +68,6 @@ registry.registrar.Console = function(params) {
|
||||||
// ready here.
|
// ready here.
|
||||||
this.history.setEnabled(true);
|
this.history.setEnabled(true);
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {!Object}
|
|
||||||
*/
|
|
||||||
this.params = params;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last active nav element.
|
* Last active nav element.
|
||||||
* @type {Element}
|
* @type {Element}
|
||||||
|
|
|
@ -27,15 +27,14 @@ goog.forwardDeclare('registry.registrar.Console');
|
||||||
/**
|
/**
|
||||||
* Session state for console.
|
* Session state for console.
|
||||||
* @param {!registry.registrar.Console} console
|
* @param {!registry.registrar.Console} console
|
||||||
* @param {string} xsrfToken Populated by server-side soy template.
|
|
||||||
* @param {string} clientId The logged in GAE user.
|
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {registry.Session}
|
* @extends {registry.Session}
|
||||||
* @final
|
* @final
|
||||||
*/
|
*/
|
||||||
registry.registrar.EppSession = function(console, xsrfToken, clientId) {
|
registry.registrar.EppSession = function(console) {
|
||||||
registry.registrar.EppSession.base(
|
registry.registrar.EppSession.base(
|
||||||
this, 'constructor', new goog.Uri('/registrar-xhr'), xsrfToken,
|
this, 'constructor', new goog.Uri('/registrar-xhr'),
|
||||||
|
console.params.xsrfToken,
|
||||||
registry.Session.ContentType.EPP);
|
registry.Session.ContentType.EPP);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,12 +47,6 @@ registry.registrar.EppSession = function(console, xsrfToken, clientId) {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.isEppLoggedIn_ = false;
|
this.isEppLoggedIn_ = false;
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {string}
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
this.clientId_ = clientId;
|
|
||||||
};
|
};
|
||||||
goog.inherits(registry.registrar.EppSession, registry.Session);
|
goog.inherits(registry.registrar.EppSession, registry.Session);
|
||||||
|
|
||||||
|
@ -74,7 +67,7 @@ registry.registrar.EppSession.prototype.isEppLoggedIn = function() {
|
||||||
* @return {string} the clientId.
|
* @return {string} the clientId.
|
||||||
*/
|
*/
|
||||||
registry.registrar.EppSession.prototype.getClientId = function() {
|
registry.registrar.EppSession.prototype.getClientId = function() {
|
||||||
return this.clientId_;
|
return this.console.params.clientId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,7 +76,7 @@ registry.registrar.EppSession.prototype.getClientId = function() {
|
||||||
* @param {function()} successCb to be called on success.
|
* @param {function()} successCb to be called on success.
|
||||||
*/
|
*/
|
||||||
registry.registrar.EppSession.prototype.login = function(successCb) {
|
registry.registrar.EppSession.prototype.login = function(successCb) {
|
||||||
var eppArgs = {clId: this.clientId_, clTrid: 'asdf-1235'};
|
var eppArgs = {clId: this.console.params.clientId, clTrid: 'asdf-1235'};
|
||||||
this.send(
|
this.send(
|
||||||
registry.soy.registrar.epp.login(eppArgs).getContent(),
|
registry.soy.registrar.epp.login(eppArgs).getContent(),
|
||||||
goog.bind(function(xml) {
|
goog.bind(function(xml) {
|
||||||
|
|
|
@ -40,9 +40,7 @@ registry.registrar.ConsoleTestUtil.setup = function(test) {
|
||||||
/** @suppress {missingRequire} */
|
/** @suppress {missingRequire} */
|
||||||
test.mockControl
|
test.mockControl
|
||||||
.createConstructorMock(registry.registrar, 'EppSession')(
|
.createConstructorMock(registry.registrar, 'EppSession')(
|
||||||
goog.testing.mockmatchers.isObject,
|
goog.testing.mockmatchers.isObject)
|
||||||
goog.testing.mockmatchers.isString,
|
|
||||||
goog.testing.mockmatchers.isString)
|
|
||||||
.$returns(test.sessionMock);
|
.$returns(test.sessionMock);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue