Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6: Migrated "auth" directory #947

Merged
merged 25 commits into from
Mar 28, 2017
Merged

ES6: Migrated "auth" directory #947

merged 25 commits into from
Mar 28, 2017

Conversation

bennycode
Copy link
Contributor

Type of change

Screenshot

get_cached_access_token() {
return new Promise(((resolve, reject) => {
let access_token = z.util.StorageUtil.get_value(z.storage.StorageKey.AUTH.ACCESS_TOKEN.VALUE);
let access_token_type = z.util.StorageUtil.get_value(z.storage.StorageKey.AUTH.ACCESS_TOKEN.TYPE);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

*/
save_access_token(access_token_data) {
let expires_in_millis = 1000 * access_token_data.expires_in;
let expiration_timestamp = Date.now() + expires_in_millis;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

*/
_log_access_token_update(access_token_data, expiration_timestamp) {
let expiration_log = z.util.format_timestamp(expiration_timestamp, false);
return this.logger.info(`Saved updated access token. It will expire on: ${expiration_log}`, access_token_data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

const POST_ACCESS = {
RETRY_LIMIT: 10,
RETRY_TIMEOUT: 500,
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be a static property as well or?

return new Promise((resolve, reject) => {
this.client.request_queue_blocked_state(z.service.RequestQueueBlockedState.ACCESS_TOKEN_REFRESH);

let config = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be const as well

key: new_user.label_key,
value: new_user.label,
}
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something is off here..

return this.renew_access_token(`Schedule for '${time}'`);
} else {
return this.logger.info(`Access token refresh scheduled for '${time}' skipped because we are offline`);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no else returns

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do this :)

@lipis lipis mentioned this pull request Mar 27, 2017
79 tasks

const _retry = () => {
return this.post_access(retry_attempt).then(resolve).catch(reject);
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const _retry = () => this.post_access(retry_attempt).then(resolve).catch(reject);

xhrFields: {
withCredentials: true,
},
}).done((data) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

})
.done(...

},
}).done((data) => {
resolve(data);
}).fail((jqXHR, textStatus, errorThrown) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

})
.fail(...

@bennycode bennycode merged commit cf2a565 into dev Mar 28, 2017
@bennycode bennycode deleted the es6-auth branch March 28, 2017 11:58
lipis added a commit that referenced this pull request Mar 28, 2017
* 'dev' of github.com:wireapp/wire-webapp:
  eslint no-else-return rule (#954)
  Reenable Firefox 45 for ESR support but disable calling
  Calling v3 optimizations (WEBAPP-3772) (#937)
  ES6: Migrated "auth" directory (#947)
  ES6: Migrated GeoLocation (#951)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants