This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/components/login-modal.js.es6
2019-03-20 14:43:25 +01:00

32 lines
791 B
JavaScript

export default Ember.Component.extend({
didInsertElement() {
this._super(...arguments);
const prefillUsername = $("#hidden-login-form input[name=username]").val();
if (prefillUsername) {
this.set("loginName", prefillUsername);
this.set(
"loginPassword",
$("#hidden-login-form input[name=password]").val()
);
} else if ($.cookie("email")) {
this.set("loginName", $.cookie("email"));
}
Ember.run.schedule("afterRender", () => {
$(
"#login-account-password, #login-account-name, #login-second-factor"
).keydown(e => {
if (e.keyCode === 13) {
this.action();
}
});
});
},
mouseMove(e) {
this.set("screenX", e.screenX);
this.set("screenY", e.screenY);
}
});