Skip to content

Commit

Permalink
Merge pull request #757 from jrjohnson/expireTime
Browse files Browse the repository at this point in the history
Better Expiration time
  • Loading branch information
thecoolestguy committed Jul 2, 2015
2 parents 79b450c + 77ed5bc commit f94371b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 7 additions & 3 deletions app/mirage/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global moment */
import getAll from './helpers/get-all';
import Mirage from 'ember-cli-mirage';

Expand Down Expand Up @@ -280,8 +281,10 @@ export default function() {
let username = attrs.username.toLowerCase();
if(errors.length === 0){
if(username === 'demo' && attrs.password === 'demo'){
let now = moment();
let nextWeek = now.clone().add(1, 'week');
let header = '{"alg":"none"}';
let body = '{"iss": "ilios","aud": "ilios","iat": "1435288723","exp": "1435317523","user_id": 4136}';
let body = `{"iss": "ilios","aud": "ilios","iat": "${now.format('X')}","exp": "${nextWeek.format('X')}","user_id": 4136}`;

let encodedData = window.btoa(header) + '.' + window.btoa(body) + '.';
return {
Expand Down Expand Up @@ -315,9 +318,10 @@ export default function() {
// return {
// jwt: null
// };

let now = moment();
let nextWeek = now.clone().add(1, 'week');
let header = '{"alg":"none"}';
let body = '{"iss": "ilios","aud": "ilios","iat": "1435288723","exp": "1435317523","user_id": 4136}';
let body = `{"iss": "ilios","aud": "ilios","iat": "${now.format('X')}","exp": "${nextWeek.format('X')}","user_id": 4136}`;

let encodedData = window.btoa(header) + '.' + window.btoa(body) + '.';
return {
Expand Down
1 change: 1 addition & 0 deletions config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ module.exports = function(environment) {
tokenPropertyName: 'jwt',
authorizationHeaderName: 'X-JWT-Authorization',
authorizationPrefix: 'Token ',
timeFactor: 1000
},
EmberENV: {
FEATURES: {
Expand Down
5 changes: 4 additions & 1 deletion tests/acceptance/dashboard/calendar-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ test('click month day number and go to day', function(assert) {
visit('/dashboard?view=month');
andThen(function() {
let dayOfMonth = today.date();
click(find('.day a').eq(dayOfMonth)).then(()=>{
let link = find('.day a').filter(function(){
return parseInt($(this).text()) === dayOfMonth;
}).eq(0);
click(link).then(()=>{
assert.equal(currentURL(), '/dashboard?date=' + today.format('YYYY-MM-DD') + '&view=day');
});
});
Expand Down

0 comments on commit f94371b

Please sign in to comment.