Skip to content

Commit 4f38f9e

Browse files
author
Joanne Pham
committed
Center Oauth authorization window
1 parent b8d458e commit 4f38f9e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

addon/services/ember-oauth2.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,13 @@ export default Ember.Service.extend(Ember.Evented, {
8181
On reject returns Object with reference to dialog and error.
8282
*/
8383
openWindow(url) {
84-
let dialog = window.open(url, 'Authorize', 'height=600, width=450');
85-
if (window.focus && dialog) {
86-
dialog.focus();
87-
}
84+
let windowWidth = 600;
85+
let windowHeight = 800;
86+
let windowLeft = (window.screen.width / 2) - (windowWidth / 2);
87+
let windowTop = (window.screen.height / 2) - (windowHeight / 2);
88+
let options = 'menubar, width=' + windowWidth + ', height=' + windowHeight + ', top=' + windowTop + ', left=' + windowLeft;
89+
let dialog = window.open(url, 'Authorize', options);
90+
if (window.focus && dialog) { dialog.focus(); }
8891
return new Ember.RSVP.Promise(function(resolve, reject) {
8992
if (dialog) {
9093
resolve(dialog);

0 commit comments

Comments
 (0)