Skip to content

Commit 6e64cf0

Browse files
author
Antoine Makdessi
committed
a
1 parent e666d49 commit 6e64cf0

37 files changed

+78799
-62
lines changed

assets/controllers/login-controller.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,27 @@ export default class extends Controller {
1414
// in a real application, the user/password should never be hardcoded
1515
// but for the demo application it's very convenient to do so
1616

17+
connect() {
18+
console.log(this.usernameTarget, this.passwordTarget)
19+
}
1720
prefillJohnUser() {
18-
this.usernameTarget.val = 'john_user'
19-
this.passwordTarget.val = 'kitten'
21+
console.log('Prefill John User')
22+
this.usernameTarget.value = 'john_user'
23+
this.passwordTarget.value = 'kitten'
2024
}
2125

2226
prefillJaneAdmin() {
23-
this.usernameTarget.val = 'jane_admin'
24-
this.passwordTarget.val = 'kitten'
27+
console.log('Prefill Jane Admin')
28+
this.usernameTarget.value = 'jane_admin'
29+
this.passwordTarget.value = 'kitten'
2530
}
2631

2732
togglePasswordInputType() {
28-
if ('password' === this.passwordTarget.input.type) {
29-
this.passwordTarget.input.type = 'text'
33+
console.log('Toggle Password Input Type')
34+
if ('password' === this.passwordTarget.type) {
35+
this.passwordTarget.type = 'text'
3036
} else {
31-
this.passwordTarget.input.type = 'password'
37+
this.passwordTarget.type = 'password'
3238
}
3339
}
3440
}

0 commit comments

Comments
 (0)