Commit dce6e12a authored by Pedro Eduardo Trujillo's avatar Pedro Eduardo Trujillo
Browse files

Emplea nuevo env, corrige reset password y limpia

Reemplaza todos los usos de rutas de servicios de la api, añadiendo una
variable a la definición en redmicConfig y reemplazándola por el valor
recibido antes de su uso (en todos aquellos lugares en que se usan).

Usa variable de producción para recaptcha, aviso de entorno, etc.

Corrige vista de reseteo de password, no estaba funcionando por errores
de código js.

Elimina ruta antigua detectada en la app nodejs, ya no se usaba para
resetear el password de usuario.
parent fa5d37bf
Loading
Loading
Loading
Loading
+2 −12
Original line number Diff line number Diff line
@@ -35,21 +35,13 @@ function onEnvRequest(req, res) {
	});
}

function onResettingRequest(req, res) {

	res.render('resetting', {
		useBuilt: params.useBuilt,
		lang: getLang(req),
		token: req.param('token')
	});
}

function onActivateAccountRequest(req, res) {

	res.render('activateAccount', {
		useBuilt: params.useBuilt,
		lang: getLang(req),
		token: req.param('token')
		apiUrl: apiUrl,
		token: req.params.token
	});
}

@@ -139,8 +131,6 @@ function exposeRoutes(app) {

		.get('/env', onEnvRequest)

		.get('/resetting/:token', onResettingRequest)

		.get('/activateAccount/:token', onActivateAccountRequest)

		.get('/noSupportBrowser', onNoSupportBrowserRequest)
+40 −24
Original line number Diff line number Diff line
define([
	"dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/request"
	, "dojo/json"
	'app/redmicConfig'
	, 'dojo/_base/declare'
	, 'dojo/_base/lang'
	, 'dojo/Deferred'
	, 'dojo/json'
	, 'dojo/request'
], function(
	declare
	redmicConfig
	, declare
	, lang
	, xhr
	, Deferred
	, JSON
	, request
){
	return declare(null, {
		//	summary:
@@ -19,10 +23,10 @@ define([

			this.config = {
				headers: {
					"Content-Type": "application/json",
					"Accept": "application/javascript, application/json"
					'Content-Type': 'application/json',
					'Accept': 'application/javascript, application/json'
				},
				handleAs: "json"
				handleAs: 'json'
			};

			lang.mixin(this, this.config, args);
@@ -31,30 +35,42 @@ define([
		save: function() {

			if (!this.isValid) {
				console.error("Tried to save invalid model '%s' with this schema:", this.get("modelName"),
					this.get("schema"));
				console.error('Tried to save invalid model \'%s\' with this schema:', this.get('modelName'),
					this.get('schema'));

				return;
			}

			if (!this.hasChanged) {
				console.error("Tried to save unchanged model '%s' with this schema:", this.get("modelName"),
					this.get("schema"));
				console.error('Tried to save unchanged model \'%s\' with this schema:', this.get('modelName'),
					this.get('schema'));

				return;
			}

			var envDfd = window.env,
				dfd = new Deferred();

			if (envDfd) {
				envDfd.then(lang.hitch(this, function(retDfd, envData) {

					var id = this.getIdValue(),
				method = this.get("isNew") ? "POST" : "PUT",
						method = this.get('isNew') ? 'POST' : 'PUT',
						data = JSON.stringify(this.serialize()),
				target = this.target + "/";
						target = redmicConfig.getServiceUrl(this.target, envData) + '/';

			return xhr(id ? target + id : target, {
					var reqDfd = request(id ? target + id : target, {
						headers: this.headers,
						handleAs: this.handleAs,
						method: method,
						data: data
					});

					reqDfd.then(lang.hitch(retDfd, retDfd.resolve), lang.hitch(retDfd, retDfd.reject));
				}, dfd));
			}

			return dfd;
		}
	});
});
+13 −8
Original line number Diff line number Diff line
@@ -43,14 +43,19 @@ define([

			_onLoadReCaptcha = null;

			var appScope = redmicConfig.getAppScope(),
				siteKey = appScope === 'pro' ? this._siteKey : this._siteKeyForDebug;
			var envDfd = window.env;
			if (envDfd) {
				envDfd.then(lang.hitch(this, function(envData) {

					var siteKey = envData.production ? this._siteKey : this._siteKeyForDebug;

					this._instanceId = grecaptcha.render(this.node, {
						'sitekey': siteKey,
						'theme': this._theme,
						'callback': this.callback
					});
				}));
			}
		},

		_instanceWasCreated: function() {
+2 −2
Original line number Diff line number Diff line
@@ -43,9 +43,9 @@ define([
			var envDfd = window.env;

			if (envDfd) {
				envDfd.then(lang.hitch(this, function(env) {
				envDfd.then(lang.hitch(this, function(envData) {

					put(this.domNode, 'div.versionNumber', env.version);
					put(this.domNode, 'div.versionNumber', envData.version);
				}));
			}

+48 −22
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ define([
	, "app/redmicConfig"
	, "dojo/_base/declare"
	, "dojo/_base/lang"
	, "dojo/Deferred"
	, "put-selector/put"
	, "templates/PlaceNamesList"
	, "redmic/store/xml2json"
@@ -19,6 +20,7 @@ define([
	, redmicConfig
	, declare
	, lang
	, Deferred
	, put
	, TemplateList
	, xml2json
@@ -54,7 +56,7 @@ define([

				label: this.i18n.placeNames,
				// General params
				baseTarget: "/grafcan",
				baseTarget: redmicConfig.services.grafcan,
				numPage: 1,
				maxSize: 100,
				idProperty: "id",
@@ -162,7 +164,18 @@ define([

		_resetTarget: function() {

			var target = this.baseTarget;
			var envDfd = window.env;

			if (!envDfd) {
				var dfd = new Deferred();
				dfd.resolve();

				return dfd;
			}

			envDfd.then(lang.hitch(this, function(envData) {

				var target = redmicConfig.getServiceUrl(this.baseTarget, envData);

				if (this.numPage !== 0) {
					target += "/" + this.numPage;
@@ -179,6 +192,9 @@ define([
				if (this.conversor) {
					this.conversor.url = this.target;
				}
			}));

			return envDfd;
		},

		_beforeShow: function(request) {
@@ -305,8 +321,9 @@ define([
			this.numPage = (from / size) + 1,
			this.maxSize = size;

			this._resetTarget();
			this._newSearch(this._lastSearch);
			var dfd = this._resetTarget();

			dfd.then(lang.hitch(this, this._newSearch, this._lastSearch));
		},

		_newSearch: function(obj) {
@@ -315,17 +332,26 @@ define([
				return;
			}

			var value = obj.text;
			var value = obj.text,
				dfd;

			if (!this._lastSearch || this._lastSearch.text !== value) {
				this._lastSearch = obj;
				this._resetPagination();
				dfd = this._resetPagination();
			}

			if (!dfd) {
				dfd = new Deferred();
				dfd.resolve();
			}

			dfd.then(lang.hitch(this, function(value) {

				// Buscamos en el servicio
				this.conversor.find({
					texto: value
				}).then(lang.hitch(this, this._responseDataConversor), lang.hitch(this, this._errorDataConversor));
			}, value));
		},

		_resetPagination: function() {
@@ -336,7 +362,7 @@ define([

			this.numPage = 1;
			this._publish(this.browser.getChannel("RESET_PAGINATION"));
			this._resetTarget();
			return this._resetTarget();
		},

		_responseDataConversor: function(res) {
Loading