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/honeypot-input.js.es6
Sam Saffron c3d06ef01a DEV: avoid making direct HTML changes in controllers
Followup on d5d8db7f, we prefer not to amend DOM directly from controllers.
2019-10-17 08:43:30 +11:00

17 lines
494 B
JavaScript

import { on } from "ember-addons/ember-computed-decorators";
export default Ember.TextField.extend({
@on("init")
_init() {
// Chrome autocomplete is buggy per:
// https://bugs.chromium.org/p/chromium/issues/detail?id=987293
// work around issue while leaving a semi useable honeypot for
// bots that are running full Chrome
if (navigator.userAgent.indexOf("Chrome") > -1) {
this.set("type", "text");
} else {
this.set("type", "password");
}
}
});