Uplift changes from fxa mono repo
This commit is contained in:
Родитель
ac94065cc1
Коммит
9f73dc1746
|
@ -7,21 +7,23 @@ mailing list or through issues here on GitHub.
|
|||
- Mailing list: <https://mail.mozilla.org/listinfo/dev-fxacct>
|
||||
- and of course, [the issues list](https://github.com/mozilla/fxa-oauth-server/issues)
|
||||
|
||||
## Bug Reports ##
|
||||
## Bug Reports
|
||||
|
||||
You can file issues here on GitHub. Please try to include as much information as you can and under what conditions
|
||||
you saw the issue.
|
||||
|
||||
## Sending Pull Requests ##
|
||||
## Sending Pull Requests
|
||||
|
||||
Patches should be submitted as pull requests (PR).
|
||||
|
||||
Before submitting a PR:
|
||||
|
||||
- Your code must run and pass all the automated tests before you submit your PR for review. "Work in progress" pull requests are allowed to be submitted, but should be clearly labeled as such and should not be merged until all tests pass and the code has been reviewed.
|
||||
- Run `npm test` to make sure all tests still pass and there are no lint errors.
|
||||
- Your patch should include new tests that cover your changes. It is your and your reviewer's responsibility to ensure your patch includes adequate tests.
|
||||
|
||||
When submitting a PR:
|
||||
|
||||
- You agree to license your code under the project's open source license ([MPL 2.0](/LICENSE)).
|
||||
- Base your branch off the current `master` (see below for an example workflow).
|
||||
- Add both your code and new tests if relevant.
|
||||
|
@ -30,11 +32,11 @@ When submitting a PR:
|
|||
|
||||
See the main [README.md](/README.md) for information on prerequisites, installing, running and testing.
|
||||
|
||||
## Code Review ##
|
||||
## Code Review
|
||||
|
||||
This project is production Mozilla code and subject to our [engineering practices and quality standards](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities). Every patch must be peer reviewed. This project is part of the [Firefox Accounts module](https://wiki.mozilla.org/Modules/Other#Firefox_Accounts), and your patch must be reviewed by one of the listed module owners or peers.
|
||||
|
||||
## Example Workflow ##
|
||||
## Example Workflow
|
||||
|
||||
This is an example workflow to make it easier to submit Pull Requests. Imagine your username is `user1`:
|
||||
|
||||
|
@ -42,31 +44,31 @@ This is an example workflow to make it easier to submit Pull Requests. Imagine y
|
|||
|
||||
2. The clone the upstream (as origin) and add your own repo as a remote:
|
||||
|
||||
```sh
|
||||
$ git clone https://github.com/mozilla/fxa-oauth-console.git
|
||||
$ cd fxa-oauth-console
|
||||
$ git remote add user1 git@github.com:user1/fxa-oauth-console.git
|
||||
```
|
||||
```sh
|
||||
$ git clone https://github.com/mozilla/fxa-oauth-console.git
|
||||
$ cd fxa-oauth-console
|
||||
$ git remote add user1 git@github.com:user1/fxa-oauth-console.git
|
||||
```
|
||||
|
||||
3. Create a branch for your fix/feature and make sure it's your currently checked-out branch:
|
||||
|
||||
```sh
|
||||
$ git checkout -b add-new-feature
|
||||
```
|
||||
```sh
|
||||
$ git checkout -b add-new-feature
|
||||
```
|
||||
|
||||
4. Add/fix code, add tests then commit and push this branch to your repo:
|
||||
|
||||
```sh
|
||||
$ git add <files...>
|
||||
$ git commit
|
||||
$ git push user1 add-new-feature
|
||||
```
|
||||
```sh
|
||||
$ git add <files...>
|
||||
$ git commit
|
||||
$ git push user1 add-new-feature
|
||||
```
|
||||
|
||||
5. From the GitHub interface for your repo, click the `Review Changes and Pull Request` which appears next to your new branch.
|
||||
|
||||
6. Click `Send pull request`.
|
||||
|
||||
### Keeping up to Date ###
|
||||
### Keeping up to Date
|
||||
|
||||
The main reason for creating a new branch for each feature or fix is so that you can track master correctly. If you need
|
||||
to fetch the latest code for a new fix, try the following:
|
||||
|
@ -76,4 +78,4 @@ $ git checkout master
|
|||
$ git pull
|
||||
```
|
||||
|
||||
Now you're ready to branch again for your new feature (from step 3 above).
|
||||
Now you're ready to branch again for your new feature (from step 3 above).
|
||||
|
|
|
@ -3,14 +3,15 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/* global require, module */
|
||||
|
||||
module.exports = function (grunt) {
|
||||
module.exports = function(grunt) {
|
||||
require('load-grunt-tasks')(grunt);
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: grunt.file.readJSON('./package.json'),
|
||||
mainJsFiles: '{,lib/**/,scripts/**/,test/**/,tasks/**/,bin/**/,app/**/}*.js'
|
||||
mainJsFiles:
|
||||
'{,lib/**/,scripts/**/,test/**/,tasks/**/,bin/**/,app/**/}*.js',
|
||||
});
|
||||
|
||||
grunt.loadTasks('tasks');
|
||||
grunt.registerTask('lint', [ 'copyright', 'eslint' ]);
|
||||
grunt.registerTask('lint', ['copyright', 'eslint']);
|
||||
};
|
||||
|
|
45
README.md
45
README.md
|
@ -1,3 +1,44 @@
|
|||
# This repository has been migrated to https://github.com/mozilla/fxa/tree/master/packages/fxa-oauth-console
|
||||
# Firefox Accounts OAuth Credential Management Dashboard
|
||||
|
||||
Please file issues and open pull requests against https://github.com/mozilla/fxa
|
||||
[![Build Status](https://travis-ci.org/mozilla/fxa-oauth-console.svg?branch=master)](https://travis-ci.org/mozilla/fxa-oauth-console)
|
||||
![](https://mdn.mozillademos.org/files/9783/dashboard-example.jpg)
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
git clone https://github.com/mozilla/fxa-oauth-console
|
||||
cd fxa-oauth-console
|
||||
npm install
|
||||
```
|
||||
|
||||
Run development server locally:
|
||||
|
||||
```
|
||||
npm start
|
||||
```
|
||||
|
||||
## Docker Dev
|
||||
|
||||
You can run the docker container by:
|
||||
|
||||
- `docker-compose build`
|
||||
- `docker-compose up`
|
||||
|
||||
#### Changing environment configuration.
|
||||
|
||||
You can customize the servers that the app communicates with by passing them in the docker-compose file.
|
||||
|
||||
```yml
|
||||
environment:
|
||||
PROFILE_URI: https://127.0.0.1:9010/v1
|
||||
OAUTH_INTERNAL_URI: https://127.0.0.1:9010/v1
|
||||
OAUTH_URI: https://127.0.0.1:1111/profile/v1
|
||||
```
|
||||
|
||||
**You will need a local Firefox Accounts stack to login to the console.** Use [fxa-local-dev](https://github.com/vladikoff/fxa-local-dev) to get started.
|
||||
|
||||
Run tests: `npm test`
|
||||
|
||||
## License
|
||||
|
||||
[MPL v2.0](LICENSE)
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
{
|
||||
"extends": "fxa/client",
|
||||
"ecmaFeatures": {
|
||||
"modules": true
|
||||
},
|
||||
"rules": {
|
||||
"semi": 0,
|
||||
"strict": [2, "never"]
|
||||
"extends": "prettier",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018,
|
||||
"sourceType": "module"
|
||||
}
|
||||
}
|
|
@ -6,8 +6,8 @@ import Ember from 'ember';
|
|||
import DS from 'ember-data';
|
||||
import config from '../config/environment';
|
||||
|
||||
function fixUpRedirectUri (uri) {
|
||||
if (! uri) {
|
||||
function fixUpRedirectUri(uri) {
|
||||
if (!uri) {
|
||||
// add some defaults, oauth server requires these fields
|
||||
uri = 'http://';
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ function fixUpRedirectUri (uri) {
|
|||
}
|
||||
|
||||
export default DS.RESTAdapter.extend({
|
||||
_handleErrorResponse: function () {
|
||||
_handleErrorResponse: function() {
|
||||
this.get('session').invalidate();
|
||||
},
|
||||
session: Ember.inject.service('session'),
|
||||
|
@ -33,9 +33,9 @@ export default DS.RESTAdapter.extend({
|
|||
*
|
||||
* Sets Authorization headers
|
||||
*/
|
||||
headers: Ember.computed(function () {
|
||||
headers: Ember.computed(function() {
|
||||
return {
|
||||
'Authorization': 'Bearer ' + this.get('session.data.authenticated.token')
|
||||
Authorization: 'Bearer ' + this.get('session.data.authenticated.token'),
|
||||
};
|
||||
}),
|
||||
|
||||
|
@ -56,9 +56,11 @@ export default DS.RESTAdapter.extend({
|
|||
*/
|
||||
findRecord: function(store, type, id, record) {
|
||||
// post process the resuld of 'findRecord'. Need to add the Model type 'client' into the response
|
||||
return this.ajax(this.buildURL(type.modelName, id, record), 'GET').then(function (resp) {
|
||||
return { client: resp };
|
||||
});
|
||||
return this.ajax(this.buildURL(type.modelName, id, record), 'GET').then(
|
||||
function(resp) {
|
||||
return { client: resp };
|
||||
}
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Overrides default RESTAdapter 'createRecord'
|
||||
|
@ -79,15 +81,16 @@ export default DS.RESTAdapter.extend({
|
|||
data.redirect_uri = fixUpRedirectUri(data.redirect_uri); //eslint-disable-line camelcase
|
||||
|
||||
// post process the result of 'find'. Need to add the Model type 'client' into the response
|
||||
return this.ajax(this.buildURL(type.modelName, null, record), 'POST', { data: data })
|
||||
.then(
|
||||
(resp) => {
|
||||
return { client: resp };
|
||||
},
|
||||
() => {
|
||||
this._handleErrorResponse()
|
||||
}
|
||||
);
|
||||
return this.ajax(this.buildURL(type.modelName, null, record), 'POST', {
|
||||
data: data,
|
||||
}).then(
|
||||
resp => {
|
||||
return { client: resp };
|
||||
},
|
||||
() => {
|
||||
this._handleErrorResponse();
|
||||
}
|
||||
);
|
||||
},
|
||||
/**
|
||||
* Overrides default RESTAdapter 'updateRecord'
|
||||
|
@ -109,17 +112,18 @@ export default DS.RESTAdapter.extend({
|
|||
data.redirect_uri = fixUpRedirectUri(data.redirect_uri); //eslint-disable-line camelcase
|
||||
|
||||
// set POST instead of PUT
|
||||
return this.ajax(this.buildURL(type.modelName, id, record), 'POST', { data: data })
|
||||
.then(
|
||||
() => {
|
||||
data.id = id;
|
||||
return this.ajax(this.buildURL(type.modelName, id, record), 'POST', {
|
||||
data: data,
|
||||
}).then(
|
||||
() => {
|
||||
data.id = id;
|
||||
|
||||
return { client: data };
|
||||
},
|
||||
() => {
|
||||
this._handleErrorResponse()
|
||||
}
|
||||
);
|
||||
return { client: data };
|
||||
},
|
||||
() => {
|
||||
this._handleErrorResponse();
|
||||
}
|
||||
);
|
||||
},
|
||||
/**
|
||||
/**
|
||||
|
@ -155,5 +159,5 @@ export default DS.RESTAdapter.extend({
|
|||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
44
app/app.js
44
app/app.js
|
@ -1,22 +1,22 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import Ember from 'ember';
|
||||
import Resolver from 'ember-resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from './config/environment';
|
||||
|
||||
let App;
|
||||
|
||||
Ember.MODEL_FACTORY_INJECTIONS = true;
|
||||
|
||||
App = Ember.Application.extend({
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix,
|
||||
Resolver
|
||||
});
|
||||
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
|
||||
export default App;
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import Ember from 'ember';
|
||||
import Resolver from 'ember-resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from './config/environment';
|
||||
|
||||
let App;
|
||||
|
||||
Ember.MODEL_FACTORY_INJECTIONS = true;
|
||||
|
||||
App = Ember.Application.extend({
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix,
|
||||
Resolver,
|
||||
});
|
||||
|
||||
loadInitializers(App, config.modulePrefix);
|
||||
|
||||
export default App;
|
||||
|
|
|
@ -36,45 +36,47 @@ export default Base.extend({
|
|||
*
|
||||
* @returns {Rx.Promise}
|
||||
*/
|
||||
authenticate: function () {
|
||||
authenticate: function() {
|
||||
var self = this;
|
||||
|
||||
return new Ember.RSVP.Promise(function (resolve, reject) {
|
||||
return new Ember.RSVP.Promise(function(resolve, reject) {
|
||||
Ember.$.ajax({
|
||||
url: self.tokenEndpoint + '/status',
|
||||
type: 'GET',
|
||||
contentType: 'application/json'
|
||||
}).then(function (response) {
|
||||
try {
|
||||
response = JSON.parse(response);
|
||||
} catch (e) {
|
||||
return reject(e);
|
||||
}
|
||||
|
||||
Ember.run(function () {
|
||||
if (response && response.email && response.token) {
|
||||
return resolve({
|
||||
email: response.email,
|
||||
token: response.token
|
||||
});
|
||||
} else {
|
||||
|
||||
return reject('Response missing credential data.');
|
||||
contentType: 'application/json',
|
||||
}).then(
|
||||
function(response) {
|
||||
try {
|
||||
response = JSON.parse(response);
|
||||
} catch (e) {
|
||||
return reject(e);
|
||||
}
|
||||
});
|
||||
}, function (xhr/*, status, error*/) {
|
||||
var response = xhr.responseText;
|
||||
|
||||
try {
|
||||
response = JSON.parse(xhr.responseText);
|
||||
} catch (e) {
|
||||
return reject();
|
||||
Ember.run(function() {
|
||||
if (response && response.email && response.token) {
|
||||
return resolve({
|
||||
email: response.email,
|
||||
token: response.token,
|
||||
});
|
||||
} else {
|
||||
return reject('Response missing credential data.');
|
||||
}
|
||||
});
|
||||
},
|
||||
function(xhr /*, status, error*/) {
|
||||
var response = xhr.responseText;
|
||||
|
||||
try {
|
||||
response = JSON.parse(xhr.responseText);
|
||||
} catch (e) {
|
||||
return reject();
|
||||
}
|
||||
|
||||
Ember.run(function() {
|
||||
return reject(response.error);
|
||||
});
|
||||
}
|
||||
|
||||
Ember.run(function () {
|
||||
return reject(response.error);
|
||||
});
|
||||
});
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -83,17 +85,16 @@ export default Base.extend({
|
|||
*
|
||||
* @returns {Rx.Promise}
|
||||
*/
|
||||
invalidate: function () {
|
||||
invalidate: function() {
|
||||
var self = this;
|
||||
|
||||
return new Ember.RSVP.Promise(function(resolve) {
|
||||
Ember.$.ajax({
|
||||
url: self.tokenEndpoint + '/logout',
|
||||
type: 'GET'
|
||||
type: 'GET',
|
||||
}).always(function() {
|
||||
return resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ export default Ember.Controller.extend({
|
|||
actions: {
|
||||
invalidateSession() {
|
||||
this.get('session').invalidate();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -9,5 +9,5 @@ export default Ember.Controller.extend({
|
|||
session: Ember.inject.service('session'),
|
||||
registrationSuccess: false,
|
||||
oauth_uri: config.servers.oauthUriParsed.href, //eslint-disable-line camelcase
|
||||
profile_uri: config.servers.profileUriParsed.href //eslint-disable-line camelcase
|
||||
profile_uri: config.servers.profileUriParsed.href, //eslint-disable-line camelcase
|
||||
});
|
||||
|
|
|
@ -7,5 +7,5 @@ import Ember from 'ember';
|
|||
export default Ember.Controller.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
sortProperties: ['name'],
|
||||
sortAscending: true
|
||||
sortAscending: true,
|
||||
});
|
||||
|
|
|
@ -7,5 +7,5 @@ import config from '../config/environment';
|
|||
|
||||
export default Ember.Controller.extend({
|
||||
session: Ember.inject.service('session'),
|
||||
server: config.servers.oauth.replace('https://', '').replace('http://', '')
|
||||
server: config.servers.oauth.replace('https://', '').replace('http://', ''),
|
||||
});
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>Firefox Accounts OAuth Credential Management Dashboard</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{content-for 'head'}}
|
||||
|
||||
<link rel="stylesheet" href="assets/vendor.css">
|
||||
<link rel="stylesheet" href="assets/fxa-oauth-console.css">
|
||||
|
||||
{{content-for 'head-footer'}}
|
||||
</head>
|
||||
<body>
|
||||
{{content-for 'body'}}
|
||||
|
||||
<script src="assets/vendor.js"></script>
|
||||
<script src="assets/fxa-oauth-console.js"></script>
|
||||
|
||||
{{content-for 'body-footer'}}
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>Firefox Accounts OAuth Credential Management Dashboard</title>
|
||||
<meta name="description" content="" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
{{content-for 'head'}}
|
||||
|
||||
<link rel="stylesheet" href="assets/vendor.css" />
|
||||
<link rel="stylesheet" href="assets/fxa-oauth-console.css" />
|
||||
|
||||
{{content-for 'head-footer'}}
|
||||
</head>
|
||||
<body>
|
||||
{{content-for 'body'}}
|
||||
|
||||
<script src="assets/vendor.js"></script>
|
||||
<script src="assets/fxa-oauth-console.js"></script>
|
||||
|
||||
{{content-for 'body-footer'}}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -9,5 +9,5 @@ export default DS.Model.extend({
|
|||
redirect_uri: DS.attr('string'), //eslint-disable-line camelcase
|
||||
secret: DS.attr('string'),
|
||||
can_grant: DS.attr('boolean'), //eslint-disable-line camelcase
|
||||
trusted: DS.attr('boolean')
|
||||
trusted: DS.attr('boolean'),
|
||||
});
|
||||
|
|
|
@ -6,19 +6,23 @@ import Ember from 'ember';
|
|||
import config from './config/environment';
|
||||
|
||||
const Router = Ember.Router.extend({
|
||||
location: config.locationType
|
||||
location: config.locationType,
|
||||
});
|
||||
|
||||
Router.map(function () {
|
||||
Router.map(function() {
|
||||
this.route('login');
|
||||
|
||||
this.route('clients', {path: '/clients'});
|
||||
this.route('clients.token', {path: '/clients/token'});
|
||||
this.route('client.register', {path:'/client/register'});
|
||||
this.route('client', {path: '/client/:client_id', resetNamespace: true}, function () {
|
||||
this.route('delete');
|
||||
this.route('update');
|
||||
});
|
||||
this.route('clients', { path: '/clients' });
|
||||
this.route('clients.token', { path: '/clients/token' });
|
||||
this.route('client.register', { path: '/client/register' });
|
||||
this.route(
|
||||
'client',
|
||||
{ path: '/client/:client_id', resetNamespace: true },
|
||||
function() {
|
||||
this.route('delete');
|
||||
this.route('update');
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
export default Router;
|
||||
|
|
|
@ -7,14 +7,14 @@ import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mi
|
|||
|
||||
export default Ember.Route.extend(ApplicationRouteMixin, {
|
||||
session: Ember.inject.service('session'),
|
||||
beforeModel: function () {
|
||||
this.get('session').authenticate('authenticator:custom')
|
||||
beforeModel: function() {
|
||||
this.get('session').authenticate('authenticator:custom');
|
||||
},
|
||||
actions: {
|
||||
authenticateSession: function () {
|
||||
authenticateSession: function() {
|
||||
this.get('session').authenticate('authenticator:custom', {});
|
||||
},
|
||||
sessionAuthenticationFailed: function (/*error*/) {
|
||||
sessionAuthenticationFailed: function(/*error*/) {
|
||||
this.transitionTo('login');
|
||||
},
|
||||
sessionInvalidationSucceeded: function() {
|
||||
|
@ -23,8 +23,8 @@ export default Ember.Route.extend(ApplicationRouteMixin, {
|
|||
sessionInvalidationFailed: function(/*error*/) {
|
||||
this.transitionTo('login');
|
||||
},
|
||||
sessionAuthenticationSucceeded: function () {
|
||||
sessionAuthenticationSucceeded: function() {
|
||||
this.transitionTo('index');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,14 +7,14 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout
|
|||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
actions: {
|
||||
remove: function (model) {
|
||||
remove: function(model) {
|
||||
var self = this;
|
||||
|
||||
return this.store.find('client', model.id).then(function (client) {
|
||||
return this.store.find('client', model.id).then(function(client) {
|
||||
client.destroyRecord().then(function() {
|
||||
self.transitionTo('clients');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,13 +7,13 @@ import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-rout
|
|||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
actions: {
|
||||
update: function (model) {
|
||||
update: function(model) {
|
||||
this.transitionTo('client.update', model);
|
||||
},
|
||||
remove: function (id) {
|
||||
return this.store.find('client', id).then(function (client) {
|
||||
remove: function(id) {
|
||||
return this.store.find('client', id).then(function(client) {
|
||||
client.destroyRecord();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -11,19 +11,20 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
create: function() {
|
||||
var model = this.controllerFor('client.register').get('model');
|
||||
|
||||
return model.save().then(
|
||||
() =>
|
||||
return model
|
||||
.save()
|
||||
.then(() =>
|
||||
this.controllerFor('client.register').set('registrationSuccess', true)
|
||||
);
|
||||
);
|
||||
},
|
||||
cancel: function() {
|
||||
this.transitionTo('clients');
|
||||
return true;
|
||||
},
|
||||
registerDone: function () {
|
||||
registerDone: function() {
|
||||
this.transitionTo('clients');
|
||||
return true;
|
||||
}
|
||||
},
|
||||
},
|
||||
setupController: function(controller, model) {
|
||||
controller.set('model', model);
|
||||
|
@ -40,5 +41,5 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
// if there is an error fetching the client list
|
||||
// then for now just invalidate the session
|
||||
this.get('session').invalidate();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -11,16 +11,16 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
var self = this;
|
||||
var model = this.controllerFor('client.update').get('model');
|
||||
|
||||
return model.save().then(function () {
|
||||
return model.save().then(function() {
|
||||
self.transitionTo('client.index', model.id);
|
||||
});
|
||||
},
|
||||
cancel: function() {
|
||||
return this.transitionTo('clients');
|
||||
}
|
||||
},
|
||||
},
|
||||
deactivate: function() {
|
||||
var model = this.controllerFor('client.update').get('model');
|
||||
model.rollbackAttributes();
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -9,32 +9,32 @@ import Client from '../models/client';
|
|||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
session: Ember.inject.service('session'),
|
||||
actions: {
|
||||
goToNewClient: function () {
|
||||
goToNewClient: function() {
|
||||
this.transitionTo('client.register');
|
||||
},
|
||||
goToClientDelete: function (model) {
|
||||
goToClientDelete: function(model) {
|
||||
this.transitionTo('client.delete', model);
|
||||
},
|
||||
goToScopedToken: function () {
|
||||
goToScopedToken: function() {
|
||||
this.transitionTo('clients.token');
|
||||
},
|
||||
goToClient: function( id ) {
|
||||
goToClient: function(id) {
|
||||
// unload all stored client data to make sure we fetch the client again in the client view
|
||||
this.store.unloadAll('client');
|
||||
this.transitionTo('client', id);
|
||||
},
|
||||
update: function (model) {
|
||||
update: function(model) {
|
||||
this.transitionTo('client.update', model);
|
||||
},
|
||||
create: function (model) {
|
||||
create: function(model) {
|
||||
this.storage.create(model);
|
||||
this.transitionTo('clients');
|
||||
},
|
||||
updated: function (model) {
|
||||
updated: function(model) {
|
||||
this.storage.update(model);
|
||||
this.transitionTo('clients');
|
||||
},
|
||||
cancel: function (model) {
|
||||
cancel: function(model) {
|
||||
Ember.run(model, 'destroy');
|
||||
this.storage.refresh(Client);
|
||||
this.transitionTo('clients');
|
||||
|
@ -43,10 +43,9 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
// if there is an error fetching the client list
|
||||
// then for now just invalidate the session
|
||||
this.get('session').invalidate();
|
||||
}
|
||||
},
|
||||
},
|
||||
model: function () {
|
||||
model: function() {
|
||||
return this.store.findAll('client');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -8,7 +8,10 @@ import config from '../../config/environment';
|
|||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
setupController: function(controller, model, queryParams) {
|
||||
controller.set('access_token', queryParams.state.fullQueryParams.access_token);
|
||||
controller.set(
|
||||
'access_token',
|
||||
queryParams.state.fullQueryParams.access_token
|
||||
);
|
||||
controller.set('scopes', queryParams.state.fullQueryParams.scopes);
|
||||
},
|
||||
actions: {
|
||||
|
@ -19,10 +22,14 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
|||
var tokenUrl = config.baseURL + 'oauth/generate-token';
|
||||
var form = Ember.$('<form />', {
|
||||
action: tokenUrl,
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
});
|
||||
form.append('<input type=hidden name=scopes value="' + Ember.$('#scopes').val() + '" />');
|
||||
form.append(
|
||||
'<input type=hidden name=scopes value="' +
|
||||
Ember.$('#scopes').val() +
|
||||
'" />'
|
||||
);
|
||||
form.appendTo('body').submit();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,8 +6,8 @@ import Ember from 'ember';
|
|||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(AuthenticatedRouteMixin, {
|
||||
beforeModel: function () {
|
||||
this.get('session').authenticate('authenticator:custom')
|
||||
beforeModel: function() {
|
||||
this.get('session').authenticate('authenticator:custom');
|
||||
return this.transitionTo('clients');
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,5 +6,5 @@ import Ember from 'ember';
|
|||
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
|
||||
|
||||
export default Ember.Route.extend(UnauthenticatedRouteMixin, {
|
||||
session: Ember.inject.service('session')
|
||||
session: Ember.inject.service('session'),
|
||||
});
|
||||
|
|
|
@ -9,5 +9,5 @@ export default DS.RESTSerializer.extend({
|
|||
isNewSerializerAPI: true,
|
||||
serializeIntoHash: function(hash, type, record, options) {
|
||||
Ember.merge(hash, this.serialize(record, options));
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// $rem-base: 16px;
|
||||
|
||||
// Allows the use of rem-calc() or lower-bound() in your settings
|
||||
@import "bower_components/foundation/scss/foundation/functions";
|
||||
@import 'bower_components/foundation/scss/foundation/functions';
|
||||
|
||||
// $experimental: true;
|
||||
|
||||
|
@ -60,12 +60,12 @@
|
|||
// $default-float: left;
|
||||
|
||||
// We use these as default colors throughout
|
||||
$primary-color: #0095DD;
|
||||
$secondary-color: #0095DD;
|
||||
$primary-color: #0095dd;
|
||||
$secondary-color: #0095dd;
|
||||
// #8e2b28 - dark red
|
||||
$alert-color: #D74345;
|
||||
$success-color: #74BF43;
|
||||
$warning-color: #FF9500;
|
||||
$alert-color: #d74345;
|
||||
$success-color: #74bf43;
|
||||
$warning-color: #ff9500;
|
||||
// $info-color: #a0d3e8;
|
||||
|
||||
// We use these to make sure border radius matches unless we want it different.
|
||||
|
@ -303,7 +303,6 @@ $warning-color: #FF9500;
|
|||
// $block-grid-default-spacing: rem-calc(20);
|
||||
// $align-block-grid-to-grid: false;
|
||||
|
||||
|
||||
// Enables media queries for block-grid classes. Set to false if writing semantic HTML.
|
||||
// $block-grid-media-queries: true;
|
||||
|
||||
|
@ -866,7 +865,6 @@ $warning-color: #FF9500;
|
|||
// $price-money-size: rem-calc(32);
|
||||
// $price-money-font-family: $body-font-family;
|
||||
|
||||
|
||||
// We use these to control the description styles
|
||||
// $price-bg: #fff;
|
||||
// $price-desc-color: #777;
|
||||
|
@ -970,8 +968,6 @@ $warning-color: #FF9500;
|
|||
// $side-nav-font-family: $body-font-family;
|
||||
// $side-nav-active-font-family: $side-nav-font-family;
|
||||
|
||||
|
||||
|
||||
// We use these to control border styles
|
||||
// $side-nav-divider-size: 1px;
|
||||
// $side-nav-divider-style: solid;
|
||||
|
@ -1033,7 +1029,6 @@ $side-nav-divider-color: scale-color($primary-color, $lightness: 80%);
|
|||
// $sub-nav-border-radius: 3px;
|
||||
// $sub-nav-font-color-hover: scale-color($sub-nav-font-color, $lightness: -25%);
|
||||
|
||||
|
||||
// We use these to control the active item styles
|
||||
// $sub-nav-active-font-weight: $font-weight-normal;
|
||||
// $sub-nav-active-bg: $primary-color;
|
||||
|
@ -1187,7 +1182,7 @@ $side-nav-divider-color: scale-color($primary-color, $lightness: 80%);
|
|||
// $include-html-top-bar-classes: $include-html-classes;
|
||||
|
||||
// Background color for the top bar
|
||||
$topbar-bg-color: #424F5A;
|
||||
$topbar-bg-color: #424f5a;
|
||||
// $topbar-bg: $topbar-bg-color;
|
||||
|
||||
// Height and margin
|
||||
|
@ -1296,4 +1291,4 @@ $topbar-margin-bottom: 45px;
|
|||
// $range-slider-handle-radius: $global-radius;
|
||||
// $range-slider-handle-round: $global-rounded;
|
||||
// $range-slider-handle-bg-hover-color: scale-color($primary-color, $lightness: -12%);
|
||||
// $range-slider-handle-cursor: pointer;
|
||||
// $range-slider-handle-cursor: pointer;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@import "settings";
|
||||
@import "public/assets/fonts/fira/fira";
|
||||
@import "bower_components/foundation/scss/foundation";
|
||||
@import 'settings';
|
||||
@import 'public/assets/fonts/fira/fira';
|
||||
@import 'bower_components/foundation/scss/foundation';
|
||||
|
||||
// Or selectively include components
|
||||
// @import
|
||||
|
@ -40,8 +40,20 @@
|
|||
// "foundation/components/offcanvas",
|
||||
// "foundation/components/visibility";
|
||||
|
||||
a, h1, h2, h3, h4, h5, h6, button, .button, th, p, legend, label {
|
||||
font-family: "Fira Sans";
|
||||
a,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
button,
|
||||
.button,
|
||||
th,
|
||||
p,
|
||||
legend,
|
||||
label {
|
||||
font-family: 'Fira Sans';
|
||||
}
|
||||
|
||||
.title-area {
|
||||
|
@ -70,7 +82,6 @@ a, h1, h2, h3, h4, h5, h6, button, .button, th, p, legend, label {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
.login-panel {
|
||||
text-align: center;
|
||||
img {
|
||||
|
|
|
@ -11,13 +11,13 @@ const updateIndex = require('./updateIndexFromEnv');
|
|||
* with config values passed in through environment variables.
|
||||
* This enables re-running the server with newer environment vars
|
||||
* without having to rebuild ember app.
|
||||
*/
|
||||
*/
|
||||
updateIndex(config)
|
||||
.then(() => {
|
||||
const server = require('../lib/server');
|
||||
const configProps = config.getProperties();
|
||||
log.debug('Starting with config: %:2j', configProps);
|
||||
const app = server.listen(configProps.server.port, function () {
|
||||
const app = server.listen(configProps.server.port, function() {
|
||||
const port = app.address().port;
|
||||
log.info('FxA OAuth Developer Console started on port:', port);
|
||||
});
|
||||
|
|
|
@ -23,7 +23,7 @@ function getConfigsFromEnv() {
|
|||
oauthUri: process.env.OAUTH_URI || undefined,
|
||||
oauthInternalUri: process.env.OAUTH_INTERNAL_URI || undefined,
|
||||
profileUri: process.env.PROFILE_URI || undefined,
|
||||
baseURL: process.env.BASE_URL || undefined
|
||||
baseURL: process.env.BASE_URL || undefined,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ function updateIndex(serverConfig) {
|
|||
}
|
||||
const currentConfig = getConfigFromHtml(html);
|
||||
const envVars = getConfigsFromEnv();
|
||||
const newConfig = applyEnvVars(currentConfig, envVars, serverConfig);
|
||||
const newConfig = applyEnvVars(currentConfig, envVars, serverConfig);
|
||||
|
||||
const baseUrl = process.env.BASE_URL || null;
|
||||
|
||||
|
@ -101,7 +101,7 @@ function updateIndex(serverConfig) {
|
|||
})
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -13,23 +13,26 @@ var url = require('url');
|
|||
module.exports = function(environment) {
|
||||
var config = require('../lib/config');
|
||||
var oauthUriParsed = url.parse(config.get('fxaOAuth').oauth_uri);
|
||||
var oauthInternalUriParsed = url.parse(config.get('fxaOAuth').oauth_internal_uri);
|
||||
var profileUriParsed = url.parse(config.get('fxaOAuth').profile_uri);
|
||||
var oauthInternalUriParsed = url.parse(
|
||||
config.get('fxaOAuth').oauth_internal_uri
|
||||
);
|
||||
var profileUriParsed = url.parse(config.get('fxaOAuth').profile_uri);
|
||||
var baseURL = config.get('base_url');
|
||||
var oauthUri = oauthUriParsed.protocol + '//' + oauthUriParsed.host;
|
||||
var oauthInternalUri = oauthInternalUriParsed.protocol + '//' + oauthInternalUriParsed.host;
|
||||
var oauthInternalUri =
|
||||
oauthInternalUriParsed.protocol + '//' + oauthInternalUriParsed.host;
|
||||
|
||||
var ENV = {
|
||||
modulePrefix: 'fxa-oauth-console',
|
||||
'simple-auth': {
|
||||
authorizer: 'authorizer:custom'
|
||||
authorizer: 'authorizer:custom',
|
||||
},
|
||||
servers: {
|
||||
oauth: oauthUri,
|
||||
oauthInternal: oauthInternalUri,
|
||||
oauthUriParsed: oauthUriParsed,
|
||||
oauthInternalUriParsed: oauthInternalUriParsed,
|
||||
profileUriParsed: profileUriParsed
|
||||
profileUriParsed: profileUriParsed,
|
||||
},
|
||||
environment: environment,
|
||||
baseURL: baseURL,
|
||||
|
@ -38,13 +41,13 @@ module.exports = function(environment) {
|
|||
FEATURES: {
|
||||
// Here you can enable experimental features on an ember canary build
|
||||
// e.g. 'with-controller': true
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
APP: {
|
||||
// Here you can pass flags/options to your application instance
|
||||
// when it is created
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
if (environment === 'development') {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version: "2.1"
|
||||
version: '2.1'
|
||||
services:
|
||||
fxa-oauth-console:
|
||||
build:
|
||||
|
@ -7,7 +7,7 @@ services:
|
|||
command: node bin/server.js
|
||||
image: mozilla/fxa-oauth-console
|
||||
ports:
|
||||
- "10137:10137"
|
||||
- '10137:10137'
|
||||
environment:
|
||||
PROFILE_URI: http://127.0.0.1:1111/profile/v1
|
||||
OAUTH_URI: http://127.0.0.1:9010/v1
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
/* global require, module */
|
||||
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||
|
||||
module.exports = function (defaults) {
|
||||
module.exports = function(defaults) {
|
||||
var app = new EmberApp(defaults, {
|
||||
hinting: false
|
||||
hinting: false,
|
||||
// Add options here
|
||||
});
|
||||
|
||||
|
|
|
@ -17,15 +17,15 @@ const conf = convict({
|
|||
doc: 'The current node.js environment',
|
||||
env: 'NODE_ENV',
|
||||
format: ['dev', 'test', 'staging', 'production'],
|
||||
default: 'dev'
|
||||
default: 'dev',
|
||||
},
|
||||
git: {
|
||||
commit: {
|
||||
doc: 'Commit SHA when in stage/production',
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'GIT_COMMIT_SHA'
|
||||
}
|
||||
env: 'GIT_COMMIT_SHA',
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Server Properties
|
||||
|
@ -33,24 +33,24 @@ const conf = convict({
|
|||
server: {
|
||||
host: {
|
||||
env: 'HOST',
|
||||
default: '127.0.0.1'
|
||||
default: '127.0.0.1',
|
||||
},
|
||||
port: {
|
||||
env: 'PORT',
|
||||
format: 'port',
|
||||
default: 10137
|
||||
default: 10137,
|
||||
},
|
||||
session: {
|
||||
env: 'COOKIE_SECRET',
|
||||
format: String,
|
||||
default: 'cookie_secret'
|
||||
}
|
||||
default: 'cookie_secret',
|
||||
},
|
||||
},
|
||||
base_url: {
|
||||
doc: 'Base URL of the application. Note: MUST end with a trailing slash',
|
||||
format: String,
|
||||
env: 'BASE_URL',
|
||||
default: '/'
|
||||
default: '/',
|
||||
},
|
||||
/**
|
||||
* FxA OAuth
|
||||
|
@ -61,57 +61,59 @@ const conf = convict({
|
|||
doc: 'The FxA client_id (8 bytes key encoded as hex)',
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'FXA_OAUTH_CLIENT_ID'
|
||||
env: 'FXA_OAUTH_CLIENT_ID',
|
||||
},
|
||||
client_secret: {
|
||||
doc: 'The FxA client secret (32 bytes key encoded as hex)',
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'FXA_OAUTH_CLIENT_SECRET'
|
||||
env: 'FXA_OAUTH_CLIENT_SECRET',
|
||||
},
|
||||
oauth_uri: {
|
||||
doc: 'The location of the FxA OAuth server.',
|
||||
format: 'url',
|
||||
default: 'https://127.0.0.1:9010/v1',
|
||||
env: 'OAUTH_URI'
|
||||
env: 'OAUTH_URI',
|
||||
},
|
||||
oauth_internal_uri: {
|
||||
doc: 'The location of the FxA OAuth internal server.',
|
||||
format: 'url',
|
||||
default: 'https://127.0.0.1:9011/v1',
|
||||
env: 'OAUTH_INTERNAL_URI'
|
||||
env: 'OAUTH_INTERNAL_URI',
|
||||
},
|
||||
redirect_uri: {
|
||||
doc: 'The redirect_uri.',
|
||||
format: String,
|
||||
default: 'https://127.0.0.1:10137/oauth/redirect',
|
||||
env: 'FXA_OAUTH_REDIRECT_URI'
|
||||
env: 'FXA_OAUTH_REDIRECT_URI',
|
||||
},
|
||||
profile_uri: {
|
||||
doc: 'The FxA profile uri.',
|
||||
format: 'url',
|
||||
default: 'https://127.0.0.1:1111/profile/v1',
|
||||
env: 'PROFILE_URI'
|
||||
env: 'PROFILE_URI',
|
||||
},
|
||||
scopes: {
|
||||
doc: 'The oauth server scopes',
|
||||
format: String,
|
||||
default: 'profile oauth',
|
||||
env: 'FXA_OAUTH_SCOPES'
|
||||
}
|
||||
env: 'FXA_OAUTH_SCOPES',
|
||||
},
|
||||
},
|
||||
/**
|
||||
* Logging
|
||||
*/
|
||||
logging: {
|
||||
default: {
|
||||
app: 'fxa-oauth-console'
|
||||
}
|
||||
}
|
||||
app: 'fxa-oauth-console',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
var envConfig = path.join(__dirname, '..', 'config', conf.get('env') + '.json');
|
||||
var files = (envConfig + ',' + process.env.CONFIG_FILES).split(',').filter(fs.existsSync);
|
||||
var files = (envConfig + ',' + process.env.CONFIG_FILES)
|
||||
.split(',')
|
||||
.filter(fs.existsSync);
|
||||
conf.loadFile(files);
|
||||
|
||||
require('mozlog').config(conf.get('logging'));
|
||||
|
|
|
@ -14,7 +14,7 @@ var fxaOAuthConfig = config.get('fxaOAuth');
|
|||
* @returns {string}
|
||||
*/
|
||||
function toQueryString(obj) {
|
||||
var fields = Object.keys(obj).map(function (key) {
|
||||
var fields = Object.keys(obj).map(function(key) {
|
||||
return key + '=' + obj[key];
|
||||
});
|
||||
|
||||
|
@ -35,10 +35,12 @@ function redirectUrl(action, nonce, scopes) {
|
|||
redirect_uri: fxaOAuthConfig.redirect_uri,
|
||||
state: nonce,
|
||||
scope: scopes || fxaOAuthConfig.scopes,
|
||||
action: action
|
||||
action: action,
|
||||
};
|
||||
|
||||
return fxaOAuthConfig.oauth_uri + '/authorization' + toQueryString(oauthParams);
|
||||
return (
|
||||
fxaOAuthConfig.oauth_uri + '/authorization' + toQueryString(oauthParams)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,17 +49,20 @@ function redirectUrl(action, nonce, scopes) {
|
|||
* @param {Function} cb
|
||||
*/
|
||||
function requestToken(code, cb) {
|
||||
request.post({
|
||||
uri: fxaOAuthConfig.oauth_uri + '/token',
|
||||
json: {
|
||||
code: code,
|
||||
client_id: fxaOAuthConfig.client_id,
|
||||
client_secret: fxaOAuthConfig.client_secret
|
||||
}
|
||||
}, cb);
|
||||
request.post(
|
||||
{
|
||||
uri: fxaOAuthConfig.oauth_uri + '/token',
|
||||
json: {
|
||||
code: code,
|
||||
client_id: fxaOAuthConfig.client_id,
|
||||
client_secret: fxaOAuthConfig.client_secret,
|
||||
},
|
||||
},
|
||||
cb
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
redirectUrl: redirectUrl,
|
||||
requestToken: requestToken
|
||||
requestToken: requestToken,
|
||||
};
|
||||
|
|
|
@ -16,14 +16,14 @@ var baseUrl = config.get('base_url');
|
|||
var fxaOAuthConfig = config.get('fxaOAuth');
|
||||
var log = require('mozlog')('server.oauth');
|
||||
// oauth flows are stored in memory
|
||||
var oauthFlows = { };
|
||||
var oauthFlows = {};
|
||||
var GENERATE_OAUTH_TOKEN_STATE = 'GENERATE_OAUTH_TOKEN';
|
||||
var DIFFERENT_BROWSER_ERROR = 3005;
|
||||
|
||||
/**
|
||||
* OAuth Login, redirects to FxA
|
||||
*/
|
||||
router.get('/login', function (req, res) {
|
||||
router.get('/login', function(req, res) {
|
||||
var nonce = crypto.randomBytes(32).toString('hex');
|
||||
oauthFlows[nonce] = true;
|
||||
req.session.state = nonce;
|
||||
|
@ -33,12 +33,14 @@ router.get('/login', function (req, res) {
|
|||
/**
|
||||
* Session Status
|
||||
*/
|
||||
router.get('/status', function (req, res) {
|
||||
router.get('/status', function(req, res) {
|
||||
if (req.session && req.session.email) {
|
||||
return res.send(JSON.stringify({
|
||||
email: req.session.email,
|
||||
token: req.session.token
|
||||
}));
|
||||
return res.send(
|
||||
JSON.stringify({
|
||||
email: req.session.email,
|
||||
token: req.session.token,
|
||||
})
|
||||
);
|
||||
} else {
|
||||
return res.status(401).end();
|
||||
}
|
||||
|
@ -47,7 +49,7 @@ router.get('/status', function (req, res) {
|
|||
/**
|
||||
* Clears local session
|
||||
*/
|
||||
router.get('/logout', function (req, res) {
|
||||
router.get('/logout', function(req, res) {
|
||||
req.session.reset();
|
||||
res.redirect(baseUrl);
|
||||
});
|
||||
|
@ -55,10 +57,12 @@ router.get('/logout', function (req, res) {
|
|||
/**
|
||||
* Generates an OAuth Token based on scope
|
||||
*/
|
||||
router.post('/generate-token', function (req, res) {
|
||||
router.post('/generate-token', function(req, res) {
|
||||
log.verbose('/generate-token', req.body);
|
||||
if (req.body.scopes) {
|
||||
return res.redirect(redirectUrl('signin', GENERATE_OAUTH_TOKEN_STATE, req.body.scopes));
|
||||
return res.redirect(
|
||||
redirectUrl('signin', GENERATE_OAUTH_TOKEN_STATE, req.body.scopes)
|
||||
);
|
||||
} else {
|
||||
return res.redirect(baseUrl + 'clients/token');
|
||||
}
|
||||
|
@ -67,7 +71,7 @@ router.post('/generate-token', function (req, res) {
|
|||
/**
|
||||
* OAuth redirect flow, redirects from FxA
|
||||
*/
|
||||
router.get('/redirect', function (req, res) {
|
||||
router.get('/redirect', function(req, res) {
|
||||
var state = req.query.state;
|
||||
var code = req.query.code;
|
||||
var error = parseInt(req.query.error, 10);
|
||||
|
@ -79,25 +83,34 @@ router.get('/redirect', function (req, res) {
|
|||
}
|
||||
|
||||
if (state && state === GENERATE_OAUTH_TOKEN_STATE) {
|
||||
requestToken(code, function (err, r, body) {
|
||||
requestToken(code, function(err, r, body) {
|
||||
if (err) {
|
||||
return res.send(400, err);
|
||||
}
|
||||
|
||||
log.verbose(GENERATE_OAUTH_TOKEN_STATE, body);
|
||||
|
||||
return res.redirect(baseUrl + 'clients/token?' +
|
||||
'access_token=' + body.access_token +
|
||||
'&scopes=' + body.scope
|
||||
return res.redirect(
|
||||
baseUrl +
|
||||
'clients/token?' +
|
||||
'access_token=' +
|
||||
body.access_token +
|
||||
'&scopes=' +
|
||||
body.scope
|
||||
);
|
||||
});
|
||||
} else if (code && state && state in oauthFlows && state === req.session.state) {
|
||||
} else if (
|
||||
code &&
|
||||
state &&
|
||||
state in oauthFlows &&
|
||||
state === req.session.state
|
||||
) {
|
||||
// state should exists in our set of active flows and the user should
|
||||
// have a cookie with that state
|
||||
delete oauthFlows[state];
|
||||
delete req.session.state;
|
||||
|
||||
requestToken(code, function (err, r, body) {
|
||||
requestToken(code, function(err, r, body) {
|
||||
if (err) {
|
||||
return res.send(r.status, err);
|
||||
}
|
||||
|
@ -105,17 +118,17 @@ router.get('/redirect', function (req, res) {
|
|||
log.verbose(err, body);
|
||||
req.session.scope = body.scope;
|
||||
req.session.token_type = body.token_type;
|
||||
var token = req.session.token = body.access_token;
|
||||
var token = (req.session.token = body.access_token);
|
||||
var profile;
|
||||
|
||||
requestProfile(token)
|
||||
.then(function (profileData) {
|
||||
.then(function(profileData) {
|
||||
profile = profileData;
|
||||
|
||||
return activateDeveloper(token);
|
||||
})
|
||||
.done(
|
||||
function (developer) {
|
||||
function(developer) {
|
||||
// only allow login if developer id is available
|
||||
if (developer && developer.developerId && profile.email) {
|
||||
req.session.email = profile.email;
|
||||
|
@ -125,7 +138,7 @@ router.get('/redirect', function (req, res) {
|
|||
}
|
||||
return res.redirect(baseUrl);
|
||||
},
|
||||
function (response) {
|
||||
function(response) {
|
||||
var msg = 'Error: Developer cannot be validated or activated';
|
||||
return res.status(response.status).send(msg);
|
||||
}
|
||||
|
@ -135,7 +148,6 @@ router.get('/redirect', function (req, res) {
|
|||
// already logged in
|
||||
return res.redirect(baseUrl);
|
||||
} else {
|
||||
|
||||
var msg = 'Bad request ';
|
||||
if (!code) {
|
||||
msg += ' - missing code';
|
||||
|
@ -146,7 +158,7 @@ router.get('/redirect', function (req, res) {
|
|||
} else if (!oauthFlows[state]) {
|
||||
msg += ' - unknown state';
|
||||
} else if (state !== req.session.state) {
|
||||
msg += ' - state cookie doesn\'t match';
|
||||
msg += " - state cookie doesn't match";
|
||||
}
|
||||
|
||||
log.error('msg', msg);
|
||||
|
@ -162,26 +174,28 @@ router.get('/redirect', function (req, res) {
|
|||
* @returns {Promise}
|
||||
*/
|
||||
function requestProfile(token) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
request.get({
|
||||
uri: fxaOAuthConfig.profile_uri + '/profile',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + token
|
||||
return new Promise(function(resolve, reject) {
|
||||
request.get(
|
||||
{
|
||||
uri: fxaOAuthConfig.profile_uri + '/profile',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + token,
|
||||
},
|
||||
json: true,
|
||||
},
|
||||
json: true
|
||||
}, function (err, r, body) {
|
||||
log.verbose(err, body);
|
||||
function(err, r, body) {
|
||||
log.verbose(err, body);
|
||||
|
||||
if (err || r.statusCode >= 400) {
|
||||
return reject({status: 400, err: err || body });
|
||||
if (err || r.statusCode >= 400) {
|
||||
return reject({ status: 400, err: err || body });
|
||||
}
|
||||
|
||||
return resolve({
|
||||
email: body.email,
|
||||
uid: body.uid,
|
||||
});
|
||||
}
|
||||
|
||||
return resolve({
|
||||
email: body.email,
|
||||
uid: body.uid
|
||||
});
|
||||
});
|
||||
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -192,25 +206,27 @@ function requestProfile(token) {
|
|||
* @returns {Promise}
|
||||
*/
|
||||
function activateDeveloper(token) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
request.post({
|
||||
uri: fxaOAuthConfig.oauth_internal_uri + '/developer/activate',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + token
|
||||
return new Promise(function(resolve, reject) {
|
||||
request.post(
|
||||
{
|
||||
uri: fxaOAuthConfig.oauth_internal_uri + '/developer/activate',
|
||||
headers: {
|
||||
Authorization: 'Bearer ' + token,
|
||||
},
|
||||
json: true,
|
||||
},
|
||||
json: true
|
||||
}, function (err, r, body) {
|
||||
log.verbose(err, body);
|
||||
function(err, r, body) {
|
||||
log.verbose(err, body);
|
||||
|
||||
if (err || r.statusCode >= 400) {
|
||||
return reject({status: 400, err: err});
|
||||
if (err || r.statusCode >= 400) {
|
||||
return reject({ status: 400, err: err });
|
||||
}
|
||||
|
||||
log.verbose('developerData', body);
|
||||
|
||||
return resolve(body);
|
||||
}
|
||||
|
||||
log.verbose('developerData', body);
|
||||
|
||||
return resolve(body);
|
||||
});
|
||||
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ var logger = require('mozlog')('server.ver.json');
|
|||
var version = require('../../package.json').version;
|
||||
|
||||
function getCommitHashFromVersionJson() {
|
||||
return Promise.attempt(function () {
|
||||
return Promise.attempt(function() {
|
||||
var configFile = path.join(__dirname, '..', '..', 'config', 'version.json');
|
||||
|
||||
if (fs.existsSync(configFile)) {
|
||||
|
@ -42,7 +42,7 @@ function getCommitHashFromVersionJson() {
|
|||
}
|
||||
|
||||
function getGitDir() {
|
||||
if (! fs.existsSync(path.join(__dirname, '..', '..', '.git'))) {
|
||||
if (!fs.existsSync(path.join(__dirname, '..', '..', '.git'))) {
|
||||
// try at '/home/app/git' for AwsBox deploys
|
||||
return path.sep + path.join('home', 'app', 'git');
|
||||
}
|
||||
|
@ -52,16 +52,19 @@ function getCommitHashFromGit() {
|
|||
var deferred = Promise.defer();
|
||||
|
||||
var gitDir = getGitDir();
|
||||
var cmd = util.format('git %s rev-parse HEAD', gitDir ? '--git-dir=' + gitDir : '');
|
||||
var cmd = util.format(
|
||||
'git %s rev-parse HEAD',
|
||||
gitDir ? '--git-dir=' + gitDir : ''
|
||||
);
|
||||
|
||||
child_process.exec(cmd, function (err, stdout) { //eslint-disable-line handle-callback-err
|
||||
child_process.exec(cmd, function(err, stdout) {
|
||||
//eslint-disable-line handle-callback-err
|
||||
deferred.resolve(stdout.replace(/\s+/, ''));
|
||||
});
|
||||
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
||||
var promise;
|
||||
function getVersionInfo() {
|
||||
// only resolve once, the data does not need to be re-calculated.
|
||||
|
@ -71,7 +74,7 @@ function getVersionInfo() {
|
|||
|
||||
// (1) read config/version.json if exists (ie. staging, production)
|
||||
promise = getCommitHashFromVersionJson()
|
||||
.then(function (commitHash) {
|
||||
.then(function(commitHash) {
|
||||
if (commitHash) {
|
||||
return commitHash;
|
||||
}
|
||||
|
@ -79,12 +82,12 @@ function getVersionInfo() {
|
|||
// or '/home/app/git' for AwsBox)
|
||||
return getCommitHashFromGit();
|
||||
})
|
||||
.then(function (commitHash) {
|
||||
.then(function(commitHash) {
|
||||
logger.info('version set to: %s', version);
|
||||
logger.info('commit hash set to: %s', commitHash);
|
||||
return {
|
||||
version: version,
|
||||
commit: commitHash
|
||||
commit: commitHash,
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -97,13 +100,12 @@ getVersionInfo();
|
|||
/**
|
||||
* OAuth Login, redirects to FxA
|
||||
*/
|
||||
router.get('*', function (req, res) {
|
||||
getVersionInfo()
|
||||
.then(function (versionInfo) {
|
||||
// charset must be set on json responses.
|
||||
res.charset = 'utf-8';
|
||||
res.json(versionInfo);
|
||||
});
|
||||
router.get('*', function(req, res) {
|
||||
getVersionInfo().then(function(versionInfo) {
|
||||
// charset must be set on json responses.
|
||||
res.charset = 'utf-8';
|
||||
res.json(versionInfo);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
@ -21,12 +21,12 @@ app.use('/ver.json', routesVersion);
|
|||
app.use(express.static(path.join(__dirname, '..', 'dist')));
|
||||
|
||||
// TODO: there should be a better way to do send through requested routes with pushState
|
||||
app.get('/*', function (req, res) {
|
||||
app.get('/*', function(req, res) {
|
||||
res.sendFile(path.join(__dirname, '..', 'dist', 'index.html'));
|
||||
});
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function (req, res, next) {
|
||||
app.use(function(req, res, next) {
|
||||
var err = new Error('Not Found');
|
||||
err.status = 404;
|
||||
next(err);
|
||||
|
@ -37,22 +37,22 @@ app.use(function (req, res, next) {
|
|||
// development error handler
|
||||
// will print stacktrace
|
||||
if (app.get('env') === 'development') {
|
||||
app.use(function (err, req, res) {
|
||||
app.use(function(err, req, res) {
|
||||
res.status(err.status || 500);
|
||||
res.render('error', {
|
||||
message: err.message,
|
||||
error: err
|
||||
error: err,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// production error handler
|
||||
// no stacktraces leaked to user
|
||||
app.use(function (err, req, res) {
|
||||
app.use(function(err, req, res) {
|
||||
res.status(err.status || 500);
|
||||
res.render('error', {
|
||||
message: err.message,
|
||||
error: {}
|
||||
error: {},
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ var conf = require('./config');
|
|||
var baseUrl = conf.get('base_url');
|
||||
var sessionSecret = conf.get('server').session;
|
||||
|
||||
if (! sessionSecret) {
|
||||
if (!sessionSecret) {
|
||||
throw new Error('Session secret not configured.');
|
||||
}
|
||||
|
||||
module.exports = function (req, res, next) {
|
||||
module.exports = function(req, res, next) {
|
||||
if (/^\/oauth/.test(req.url)) {
|
||||
res.setHeader('Cache-Control', 'no-cache, max-age=0');
|
||||
|
||||
|
@ -23,8 +23,8 @@ module.exports = function (req, res, next) {
|
|||
requestKey: 'session',
|
||||
cookie: {
|
||||
path: baseUrl + 'oauth',
|
||||
httpOnly: true
|
||||
}
|
||||
httpOnly: true,
|
||||
},
|
||||
})(req, res, next);
|
||||
} else {
|
||||
return next();
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -9,7 +9,8 @@
|
|||
"test": "ember test && grunt lint",
|
||||
"postinstall": "node_modules/.bin/bower install --config.interactive=false -s --allow-root",
|
||||
"outdated": "npm outdated --depth 0",
|
||||
"contributors": "git shortlog -s | cut -c8- | sort -f > CONTRIBUTORS"
|
||||
"contributors": "git shortlog -s | cut -c8- | sort -f > CONTRIBUTORS",
|
||||
"format": "prettier '**' --write"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -55,15 +56,17 @@
|
|||
"ember-cli-qunit": "1.2.1",
|
||||
"ember-cli-release": "0.2.8",
|
||||
"ember-cli-uglify": "1.2.0",
|
||||
"eslint-config-fxa": "3.0.0",
|
||||
"eslint-config-prettier": "^5.0.0",
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-cli": "^1.2.0",
|
||||
"grunt-concurrent": "^2.3.1",
|
||||
"grunt-contrib-jshint": "1.1.0",
|
||||
"grunt-copyright": "0.3.0",
|
||||
"grunt-eslint": "19.0.0",
|
||||
"grunt-eslint": "21.1.0",
|
||||
"load-grunt-tasks": "3.5.2",
|
||||
"natives": "1.1.6",
|
||||
"nodemon": "^1.2.1",
|
||||
"prettier": "^1.18.2",
|
||||
"xmlhttprequest": "git://github.com/zaach/node-XMLHttpRequest.git#onerror"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
@font-face{
|
||||
font-family: 'Fira Sans';
|
||||
src: url('fonts/fira/eot/FiraSans-Regular.eot');
|
||||
src: local('Fira Sans Regular'),
|
||||
url('fonts/fira/eot/FiraSans-Regular.eot') format('embedded-opentype'),
|
||||
url('fonts/fira/woff/FiraSans-Regular.woff') format('woff'),
|
||||
url('fonts/fira/ttf/FiraSans-Regular.ttf') format('truetype');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
@font-face {
|
||||
font-family: 'Fira Sans';
|
||||
src: url('fonts/fira/eot/FiraSans-Regular.eot');
|
||||
src: local('Fira Sans Regular'),
|
||||
url('fonts/fira/eot/FiraSans-Regular.eot') format('embedded-opentype'),
|
||||
url('fonts/fira/woff/FiraSans-Regular.woff') format('woff'),
|
||||
url('fonts/fira/ttf/FiraSans-Regular.ttf') format('truetype');
|
||||
font-weight: 400;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face{
|
||||
font-family: 'Fira Sans';
|
||||
src: url('fonts/fira/eot/FiraSans-Bold.eot');
|
||||
src: local('Fira Sans Bold'),
|
||||
url('fonts/fira/eot/FiraSans-Bold.eot') format('embedded-opentype'),
|
||||
url('fonts/fira/woff/FiraSans-Bold.woff') format('woff'),
|
||||
url('fonts/fira/ttf/FiraSans-Bold.ttf') format('truetype');
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
@font-face {
|
||||
font-family: 'Fira Sans';
|
||||
src: url('fonts/fira/eot/FiraSans-Bold.eot');
|
||||
src: local('Fira Sans Bold'),
|
||||
url('fonts/fira/eot/FiraSans-Bold.eot') format('embedded-opentype'),
|
||||
url('fonts/fira/woff/FiraSans-Bold.woff') format('woff'),
|
||||
url('fonts/fira/ttf/FiraSans-Bold.ttf') format('truetype');
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,18 @@ const path = require('path');
|
|||
var config = require('../lib/config').get('server');
|
||||
console.log(config); // eslint-disable-line no-console
|
||||
|
||||
var emberBuild = cp.spawn(path.join(__dirname, '..', 'node_modules', '.bin', 'ember'), ['build', '--watch'], { stdio: 'inherit' });
|
||||
var emberBuild = cp.spawn(
|
||||
path.join(__dirname, '..', 'node_modules', '.bin', 'ember'),
|
||||
['build', '--watch'],
|
||||
{ stdio: 'inherit' }
|
||||
);
|
||||
emberBuild.on('exit', process.exit);
|
||||
|
||||
var server = cp.spawn(path.join(__dirname, '..', 'node_modules', '.bin', 'nodemon'), ['bin/server.js', '--watch', 'lib'], { stdio: 'inherit' });
|
||||
var server = cp.spawn(
|
||||
path.join(__dirname, '..', 'node_modules', '.bin', 'nodemon'),
|
||||
['bin/server.js', '--watch', 'lib'],
|
||||
{ stdio: 'inherit' }
|
||||
);
|
||||
server.on('exit', process.exit);
|
||||
|
||||
var port = config.port === '80' ? '' : ':' + config.port;
|
||||
|
|
|
@ -3,16 +3,13 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/* global module */
|
||||
|
||||
module.exports = function (grunt) {
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.config('copyright', {
|
||||
app: {
|
||||
options: {
|
||||
pattern: /This Source Code Form is subject to the terms of the Mozilla/
|
||||
pattern: /This Source Code Form is subject to the terms of the Mozilla/,
|
||||
},
|
||||
src: [
|
||||
'<%= mainJsFiles %>'
|
||||
]
|
||||
}
|
||||
src: ['<%= mainJsFiles %>'],
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -3,14 +3,11 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/* global module */
|
||||
|
||||
module.exports = function (grunt) {
|
||||
|
||||
module.exports = function(grunt) {
|
||||
grunt.config('eslint', {
|
||||
app: {
|
||||
options: { eslintrc: '.eslintrc' },
|
||||
src: [
|
||||
'<%= mainJsFiles %>'
|
||||
]
|
||||
}
|
||||
src: ['<%= mainJsFiles %>'],
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
14
testem.js
14
testem.js
|
@ -3,13 +3,9 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
/*jshint node:true*/
|
||||
module.exports = {
|
||||
'framework': 'qunit',
|
||||
'test_page': 'tests/index.html?hidepassed',
|
||||
'disable_watching': true,
|
||||
'launch_in_ci': [
|
||||
'Firefox'
|
||||
],
|
||||
'launch_in_dev': [
|
||||
'Firefox'
|
||||
]
|
||||
framework: 'qunit',
|
||||
test_page: 'tests/index.html?hidepassed',
|
||||
disable_watching: true,
|
||||
launch_in_ci: ['Firefox'],
|
||||
launch_in_dev: ['Firefox'],
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* globals blanket */
|
||||
|
||||
blanket.options({
|
||||
filter: "//.*fxa-oauth-console/.*/",
|
||||
antifilter: "//.*(tests|templates).*/",
|
||||
loaderExclusions: ['simple-auth']
|
||||
});
|
||||
filter: '//.*fxa-oauth-console/.*/',
|
||||
antifilter: '//.*(tests|templates).*/',
|
||||
loaderExclusions: ['simple-auth'],
|
||||
});
|
||||
|
|
|
@ -18,6 +18,6 @@ export default function(name, options = {}) {
|
|||
}
|
||||
|
||||
destroyApp(this.application);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import Resolver from 'ember/resolver';
|
||||
import config from '../../config/environment';
|
||||
|
||||
const resolver = Resolver.create();
|
||||
|
||||
resolver.namespace = {
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix
|
||||
};
|
||||
|
||||
export default resolver;
|
||||
import Resolver from 'ember/resolver';
|
||||
import config from '../../config/environment';
|
||||
|
||||
const resolver = Resolver.create();
|
||||
|
||||
resolver.namespace = {
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix,
|
||||
};
|
||||
|
||||
export default resolver;
|
||||
|
|
|
@ -1,34 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>FxaOauthConsole Tests</title>
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{{content-for 'head'}}
|
||||
{{content-for 'test-head'}}
|
||||
|
||||
<link rel="stylesheet" href="assets/vendor.css">
|
||||
<link rel="stylesheet" href="assets/fxa-oauth-console.css">
|
||||
<link rel="stylesheet" href="assets/test-support.css">
|
||||
|
||||
{{content-for 'head-footer'}}
|
||||
{{content-for 'test-head-footer'}}
|
||||
</head>
|
||||
<body>
|
||||
{{content-for 'body'}}
|
||||
{{content-for 'test-body'}}
|
||||
|
||||
<script src="assets/vendor.js"></script>
|
||||
<script src="assets/test-support.js"></script>
|
||||
<script src="assets/fxa-oauth-console.js"></script>
|
||||
<script src="testem.js" integrity=""></script>
|
||||
<script src="assets/tests.js"></script>
|
||||
<script src="assets/test-loader.js"></script>
|
||||
|
||||
{{content-for 'body-footer'}}
|
||||
{{content-for 'test-body-footer'}}
|
||||
</body>
|
||||
</html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>FxaOauthConsole Tests</title>
|
||||
<meta name="description" content="" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
|
||||
{{content-for 'head'}} {{content-for 'test-head'}}
|
||||
|
||||
<link rel="stylesheet" href="assets/vendor.css" />
|
||||
<link rel="stylesheet" href="assets/fxa-oauth-console.css" />
|
||||
<link rel="stylesheet" href="assets/test-support.css" />
|
||||
|
||||
{{content-for 'head-footer'}} {{content-for 'test-head-footer'}}
|
||||
</head>
|
||||
<body>
|
||||
{{content-for 'body'}} {{content-for 'test-body'}}
|
||||
|
||||
<script src="assets/vendor.js"></script>
|
||||
<script src="assets/test-support.js"></script>
|
||||
<script src="assets/fxa-oauth-console.js"></script>
|
||||
<script src="testem.js" integrity=""></script>
|
||||
<script src="assets/tests.js"></script>
|
||||
<script src="assets/test-loader.js"></script>
|
||||
|
||||
{{content-for 'body-footer'}} {{content-for 'test-body-footer'}}
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import resolver from './helpers/resolver';
|
||||
import {
|
||||
setResolver
|
||||
} from 'ember-qunit';
|
||||
import { setResolver } from 'ember-qunit';
|
||||
|
||||
setResolver(resolver);
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:client/register', 'ClientRegisterController', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:clients', 'ClientsController', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('controller:login', 'LoginController', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
import {
|
||||
moduleForModel,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleForModel, test } from 'ember-qunit';
|
||||
|
||||
moduleForModel('client', 'Client', {
|
||||
// Specify the other units that are required for this test.
|
||||
needs: []
|
||||
needs: [],
|
||||
});
|
||||
|
||||
test('it exists', function(assert) {
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:client/delete', 'ClientDeleteRoute', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:client/index', 'ClientIndexRoute', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:client/register', 'ClientRegisterRoute', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:client/update', 'ClientUpdateRoute', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:clients', 'ClientsRoute', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:clients/token', 'ClientsTokenRoute', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:index', 'IndexRoute', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
moduleFor,
|
||||
test
|
||||
} from 'ember-qunit';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
|
||||
moduleFor('route:login', 'LoginRoute', {
|
||||
// Specify the other units that are required for this test.
|
||||
|
|
Загрузка…
Ссылка в новой задаче