Commit ba3d887a authored by Moises Sacal's avatar Moises Sacal

added host info to be displayed at the login page

parent 548f357c
This diff is collapsed.
......@@ -27,6 +27,7 @@ export class LabarchivesLoginField extends FieldBase<any> {
submitted = false;
errorMessage: string = undefined;
closeLabel: string;
location: string;
user: any;
loggedIn: boolean;
......@@ -67,6 +68,8 @@ export class LabarchivesLoginField extends FieldBase<any> {
const userInfo = await this.labarchivesService.getUserInfo();
const user = userInfo['user'];
this.userEmail = user['email'];
const info = await this.labarchivesService.info();
this.location = info['location'];
}
async login(form) {
......@@ -144,6 +147,7 @@ export class LabarchivesLoginField extends FieldBase<any> {
<div *ngIf="!field.loggedIn" class="col-md-6">
<div class="form-row">
<p>{{ field.helpLoginLabel }}</p>
<p><a href="{{ field.location }}" target="_blank" rel="noopener noreferrer">{{ field.location }}</a></p>
<ul>
<li *ngFor="let help of field.helpLoginLabelList">{{ help }}</li>
</ul>
......
......@@ -34,6 +34,19 @@ export class LabarchivesService extends BaseService {
}
}
public async info() {
const wsUrl = this.brandingAndPortalUrl + '/ws/labarchives/info';
try {
const result = await this.http.get(
wsUrl,
this.options
).toPromise();
return Promise.resolve(this.extractData(result));
} catch (e) {
return Promise.reject(new Error(e));
}
}
public async login(username, password) {
const wsUrl = this.brandingAndPortalUrl + '/ws/labarchives/login';
try {
......
......@@ -11,6 +11,7 @@ var Controllers;
constructor() {
super();
this._exportedMethods = [
'info',
'login',
'link',
'checkLink',
......@@ -18,6 +19,10 @@ var Controllers;
];
this.config = new Config_1.Config(sails.config.workspaces);
}
info(req, res) {
this.config.brandingAndPortalUrl = BrandingService.getFullPath(req);
this.ajaxOk(req, res, null, { location: this.config.location, status: true });
}
login(req, res) {
const user = {
username: req.param('username'),
......
......@@ -56,6 +56,7 @@ module.exports = function (sails) {
routes: {
before: {},
after: {
'get /:branding/:portal/ws/labarchives/info': LabarchivesController.info,
'get /:branding/:portal/ws/labarchives/list': LabarchivesController.list,
'post /:branding/:portal/ws/labarchives/login': LabarchivesController.login,
'post /:branding/:portal/ws/labarchives/link': LabarchivesController.link,
......
......@@ -22,6 +22,7 @@ export module Controllers {
export class LabarchivesController extends controller.Controllers.Core.Controller {
protected _exportedMethods: any = [
'info',
'login',
'link',
'checkLink',
......@@ -36,6 +37,11 @@ export module Controllers {
this.config = new Config(sails.config.workspaces);
}
public info(req, res) {
this.config.brandingAndPortalUrl = BrandingService.getFullPath(req);
this.ajaxOk(req, res, null, {location: this.config.location, status: true});
}
login(req, res) {
const user = {
username: req.param('username'),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment