diff --git a/server.js b/server.js index 4d2f793..5043c03 100644 --- a/server.js +++ b/server.js @@ -46,6 +46,7 @@ var orcidLogger = new console.Console(orcidOutput, orcidErrorOutput); //Endpoints var CONFIG = '/config'; var CREATE_SMID_AUTHORIZE = '/create-smid-authorize'; +var CREATE_SMID_EMAIL = '/create-smid-email'; var CONFIG = '/config'; var CREATE_SMID_URI = '/create-smid-redirect'; var COLLECTION_DETAILS = '/:publicKey/details'; @@ -210,12 +211,13 @@ app.post(EMAIL_SMID, function(req, res) { console.log(error); if (body != null && body.message != null && body.message.includes("Great job")) res.status(200).json({'email': data.email, 'redirect': create_smid_authorization_uri }); // using test credentials + else res.status(400).json({'error':error, 'body': body}); } else { console.log("mailgun body:"); console.log(body); - res.status(200).json({'email': data.email}); + res.status(200).json({'email': data.email, 'redirect': create_smid_authorization_uri }); } }); }); @@ -273,6 +275,10 @@ app.get([COLLECTION_EDIT], function(req, res) { // Index page }); }); +app.get([CREATE_SMID_EMAIL, '/'], function(req, res) { // Index page + res.status(200).sendFile(index_file); +}); + app.get([COLLECTION_SHARE, ADD_ID_SUCCESS, ADD_ID_ERROR], function(req, res) { // Index page smidManger.detailsExist(req.params.publicKey, function(err, bool) { if (bool == true) @@ -281,7 +287,3 @@ app.get([COLLECTION_SHARE, ADD_ID_SUCCESS, ADD_ID_ERROR], function(req, res) { / res.sendFile(PAGE_404); }); }); - -app.get('/', function(req, res) { // Index page - res.status(200).sendFile(index_file); -}); \ No newline at end of file diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index f40274e..f99ad7e 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -4,6 +4,7 @@ import { Routes, RouterModule } from '@angular/router'; import { AddIdErrorComponent } from './add-id-error/add-id-error.component'; import { AddIdSuccessComponent } from './add-id-success/add-id-success.component'; import { CollectionEditComponent } from './collection-edit/collection-edit.component'; +import { CollectionEmailComponent } from './collection-email/collection-email.component'; import { CollectionShareComponent } from './collection-share/collection-share.component'; import { PageHomeComponent } from './page-home/page-home.component'; @@ -12,6 +13,10 @@ const routes: Routes = [ component: PageHomeComponent, // Authenticate -> Redirects to editCollection path: '' }, + { + component: CollectionEmailComponent, + path: 'create-smid-email' + }, /* Be sure to put urls with :dinamicParam after the ones that are static. Other way the evaluation will redirect to them instead of the expected url. */ { diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3fe38db..b0f7687 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -19,6 +19,7 @@ import { OrcidUtilService } from './shared/orcid-util/orcid-util.service'; import { FooterComponent } from './footer/footer.component'; import { HeaderComponent } from './header/header.component'; import { PageHomeComponent } from './page-home/page-home.component'; +import { CollectionEmailComponent } from './collection-email/collection-email.component'; @NgModule({ @@ -30,7 +31,8 @@ import { PageHomeComponent } from './page-home/page-home.component'; CollectionShareComponent, FooterComponent, HeaderComponent, - PageHomeComponent + PageHomeComponent, + CollectionEmailComponent, ], imports: [ Angular2FontAwesomeModule, diff --git a/src/app/collection-edit/collection-edit.component.html b/src/app/collection-edit/collection-edit.component.html index 27d681e..0371062 100644 --- a/src/app/collection-edit/collection-edit.component.html +++ b/src/app/collection-edit/collection-edit.component.html @@ -74,36 +74,8 @@

Collection Links Hold onto these!

-
- - - -
-

Uh oh, email not sent! Check the address and try again.

-

Success! Links sent to {{email}}