Validate Ethereum addresses in input fields

This commit is contained in:
2019-07-22 17:29:31 +02:00
parent d6d2b1a61c
commit a8ae2b0156
4 changed files with 247 additions and 8 deletions
+15 -5
View File
@@ -1,13 +1,23 @@
import Controller from '@ember/controller';
import { not, notEmpty } from '@ember/object/computed';
// import { computed } from '@ember/object';
import { computed } from '@ember/object';
import { not } from '@ember/object/computed';
import { isAddress } from 'web3-utils';
export default Controller.extend({
ethAddress: null,
// TODO address validation
isValidEthAccount: notEmpty('ethAddress'),
signupButtonDisabled: not('isValidEthAccount')
isValidEthAccount: computed('ethAddress', function() {
return isAddress(this.ethAddress);
}),
signupButtonDisabled: not('isValidEthAccount'),
actions: {
completeSignup() {
}
}
});