Skip to content

Commit 96ff8e9

Browse files
authored
Merge pull request #71 from huangqun/dev
replace login implementation
2 parents acba791 + 8c0e1a7 commit 96ff8e9

25 files changed

+817
-653
lines changed

README.md

+10-15
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,26 @@ The following configuration parameters are available:
2828

2929
| Name | Description |
3030
|--------------------------|---------------------------------|
31-
| ES_PROJECT_API_URL | URL of the ES project API |
3231
| API_URL | URL of the topcoder API |
33-
| WORK_API_URL | URL of the topcoder work API |
3432
| ADMIN_TOOL_URL | URL of the admin tool API |
3533
| API_VERSION_PATH | Version of the API |
36-
| AUTH0_CLIENT_ID | Client ID for Auth0 |
37-
| AUTH0_DOMAIN | Domain for Auth0 authentication |
38-
| AUTH0_TOKEN_NAME | Auth0 token name |
39-
| AUTH0_REFRESH_TOKEN_NAME | Auth0 refresh token name |
34+
| COOKIES_SECURE | If true the cookies set by this App will only be transmitted over secure protocols like https. |
35+
| AUTH_URL | Url of Topcoder auth form |
36+
| ACCOUNTS_CONNECTOR_URL | Url to TC account connector |
37+
| JWT_V3_NAME | jwt V3 cookie name |
38+
| JWT_V2_NAME | jwt V2 cookie name |
4039

4140
## Start the Application
4241

42+
As application uses Topcoder authorization we have to run it on the one of allowed domains. For development purposes we can use `local.topcoder-dev.com:3000`. So before run we have to add into `hosts` file the line `127.0.0.1 local.topcoder-dev.com`. Be aware, that we also have to run on the port `3000` to be able to authorize when run locally.
43+
4344
Simply execute the following command to start the app in development mode (with browsersync)
4445
```
4546
npm install
46-
npm start
47-
```
48-
Application will be hosted and running at http://locahost:3000
49-
50-
To build the application to be hosted on a real webserver run:
51-
```
52-
npm run build
47+
gulp build
48+
gulp serve
5349
```
50+
Application will be hosted and running at http://local.topcoder-dev.com:3000.
5451

5552
## Execute E2E Tests
5653

@@ -59,8 +56,6 @@ Before executing the end-to-end (e2e) protractor tests, these environment variab
5956
| Name | Description | Default Value |
6057
| --- | --- | --- |
6158
| BUILD_ENV | Deployment configuration to be tested by e2e tests. | See [Configuration](#configuration) for possible values. Defaults to `dev`. |
62-
| TEST_USER | Account username to use for e2e tests. | No default. Must be set. |
63-
| TEST_PASSWORD | Account password to use for e2e tests. | No default. Must be set. |
6459
| TEST_PORT | Port from which to serve the app for e2e tests. | Defaults to `3000`. |
6560

6661
```npm test```

bower.json

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@
2121
"a0-angular-storage": "~0.0.11",
2222
"angular-jwt": "~0.0.9",
2323
"angular-footable": "~1.0.3",
24-
"appirio-tech-ng-auth": "git://github.com/appirio-tech/ng-auth.git#3.2.10",
25-
"appirio-tech-ng-login-reg": "0.x.x",
26-
"appirio-tech-ng-api-services": "0.x.x",
2724
"angular-clipboard": "~1.2.1",
2825
"lodash": "~4.2.0",
2926
"angular-moment": "~1.0.0-beta.3",

config.json

+20-24
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,42 @@
11
{
22
"local": {
3-
"ES_PROJECT_API_URL": "http://127.0.0.1:8553",
43
"API_URL" : "https://127.0.0.1:8443",
5-
"WORK_API_URL" : "https://127.0.0.1:8443",
64
"ADMIN_TOOL_URL" : "http://localhost:8080/api/v2",
75
"API_VERSION_PATH" : "v3",
8-
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
9-
"AUTH0_DOMAIN" : "127.0.0.1:8443",
10-
"AUTH0_TOKEN_NAME" : "userJWTToken",
11-
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
6+
"COOKIES_SECURE": false,
7+
"AUTH_URL": "https://accounts.topcoder-dev.com/member",
8+
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder-dev.com/connector.html",
9+
"JWT_V3_NAME": "v3jwt",
10+
"JWT_V2_NAME": "tcjwt"
1211
},
1312
"dev": {
14-
"ES_PROJECT_API_URL": "https://internal-api.topcoder-dev.com",
1513
"API_URL" : "https://api.topcoder-dev.com",
16-
"WORK_API_URL" : "https://api-work.topcoder-dev.com",
1714
"ADMIN_TOOL_URL" : "https://api.topcoder-dev.com/v2",
1815
"API_VERSION_PATH" : "v3",
19-
"AUTH0_CLIENT_ID" : "JFDo7HMkf0q2CkVFHojy3zHWafziprhT",
20-
"AUTH0_DOMAIN" : "topcoder-dev.auth0.com",
21-
"AUTH0_TOKEN_NAME" : "userJWTToken",
22-
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
16+
"COOKIES_SECURE": false,
17+
"AUTH_URL": "https://accounts.topcoder-dev.com/member",
18+
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder-dev.com/connector.html",
19+
"JWT_V3_NAME": "v3jwt",
20+
"JWT_V2_NAME": "tcjwt"
2321
},
2422
"qa": {
25-
"ES_PROJECT_API_URL": "https://internal-api.topcoder-qa.com",
2623
"API_URL" : "https://api.topcoder-qa.com",
27-
"WORK_API_URL" : "https://api-work.topcoder-qa.com",
2824
"ADMIN_TOOL_URL" : "https://api.topcoder-qa.com/v2",
2925
"API_VERSION_PATH" : "v3",
30-
"AUTH0_CLIENT_ID" : "EVOgWZlCtIFlbehkq02treuRRoJk12UR",
31-
"AUTH0_DOMAIN" : "topcoder-qa.auth0.com",
32-
"AUTH0_TOKEN_NAME" : "userJWTToken",
33-
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
26+
"COOKIES_SECURE": false,
27+
"AUTH_URL": "https://accounts.topcoder-qa.com/member",
28+
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder-qa.com/connector.html",
29+
"JWT_V3_NAME": "v3jwt",
30+
"JWT_V2_NAME": "tcjwt"
3431
},
3532
"prod": {
3633
"API_URL" : "https://api.topcoder.com",
37-
"WORK_API_URL" : "https://api-work.topcoder.com",
38-
"ES_PROJECT_API_URL": "https://internal-api.topcoder.com",
3934
"ADMIN_TOOL_URL" : "https://api.topcoder.com/v2",
4035
"API_VERSION_PATH" : "v3",
41-
"AUTH0_CLIENT_ID" : "6ZwZEUo2ZK4c50aLPpgupeg5v2Ffxp9P",
42-
"AUTH0_DOMAIN" : "topcoder.auth0.com",
43-
"AUTH0_TOKEN_NAME" : "userJWTToken",
44-
"AUTH0_REFRESH_TOKEN_NAME" : "userRefreshJWTToken"
36+
"COOKIES_SECURE": false,
37+
"AUTH_URL": "https://accounts.topcoder.com/member",
38+
"ACCOUNTS_CONNECTOR_URL": "https://accounts.topcoder.com/connector.html",
39+
"JWT_V3_NAME": "v3jwt",
40+
"JWT_V2_NAME": "tcjwt"
4541
}
4642
}

e2e/dashboard.spec.js

-19
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
11
'use strict';
22

33
describe('The dashboard view', function () {
4-
var page;
54
var mainPage;
6-
var testUser = process.env.TEST_USER;
7-
var testPassword = process.env.TEST_PASSWORD;
85
var testPort = process.env.TEST_PORT || 3000;
96

107
beforeEach(function () {
118
browser.get('http://localhost:' + testPort + '/');
12-
page = require('./login.po');
139
mainPage = require('./main.po');
1410
});
15-
16-
it('should have environment variables defined', function(){
17-
expect(testUser).toBeDefined();
18-
expect(testPassword).toBeDefined();
19-
});
20-
21-
it('should find members', function() {
22-
page.usernameInput.sendKeys(testUser);
23-
page.passwordInput.sendKeys(testPassword);
24-
page.loginButton.click();
25-
mainPage.searchHandleInput.sendKeys('sah2ed');
26-
mainPage.searchButton.click();
27-
expect(mainPage.users.count()).toBe(1);
28-
expect(mainPage.users.get(0).element(by.cssContainingText('td', 'sah2ed')).getText()).toBe('sah2ed');
29-
});
3011
});

e2e/login.po.js

-22
This file was deleted.

e2e/login.spec.js

-56
This file was deleted.

gulp/server.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ function browserSyncInit(baseDir, files, browser) {
2727
middleware: middleware,
2828
routes: routes
2929
},
30-
browser: browser
30+
browser: browser,
31+
host: 'local.topcoder-dev.com',
32+
open: 'external'
3133
});
3234
}
3335

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"gulp-useref": "~1.0.2",
3434
"http-proxy": "~1.7.0",
3535
"jasmine-core": "^2.5.2",
36-
"jshint":"~2.9.4",
36+
"jshint": "~2.9.4",
3737
"jshint-stylish": "~1.0.0",
3838
"main-bower-files": "~2.13.1",
3939
"protractor": "~5.1.1",

protractor.conf.js

-7
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ exports.config = {
1111
'browserName': 'chrome'
1212
},
1313

14-
onPrepare: function() {
15-
// check if env variables for testing are set
16-
if (typeof process.env.TEST_USER === "undefined" || typeof process.env.TEST_PASSWORD === "undefined") {
17-
throw "The environment variables TEST_USER and TEST_PASSWORD should be set in order for the tests to work";
18-
}
19-
},
20-
2114
// Spec patterns are relative to the current working directly when
2215
// protractor is called.
2316
specs: [paths.e2e + '/**/*.js'],

src/app/addmembers/add.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var module = angular.module('supportAdminApp');
44

5-
module.controller('addmembers.AddMemberController', ['$log', '$scope', '$parse', 'AuthService', 'MemberService', function ($log, $scope, $parse, $authService, $memberService) {
5+
module.controller('addmembers.AddMemberController', ['$log', '$scope', '$parse', 'MemberService', function ($log, $scope, $parse, $memberService) {
66

77
$scope.errors = [];
88
$scope.response = [];

0 commit comments

Comments
 (0)