Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22396309
password-generate-button.stimulus.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
632 B
Referenced Files
None
Subscribers
None
password-generate-button.stimulus.ts
View Options
/// <reference lib="dom" />
import
{
Controller
}
from
"stimulus"
;
function
generatePassword
()
{
const
chars
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"
;
let
password
=
""
;
for
(
let
i
=
0
;
i
<
8
;
i
++
)
{
password
+=
chars
.
charAt
(
Math
.
floor
(
Math
.
random
()
*
chars
.
length
));
}
return
password
;
}
export
default
class
extends
Controller
<
HTMLButtonElement
>
{
getInput
()
:
HTMLInputElement
{
return
this
.
element
.
parentElement
!
.
querySelector
(
"input"
)
as
HTMLInputElement
;
}
generate
()
{
this
.
getInput
().
value
=
generatePassword
();
this
.
getInput
().
setAttribute
(
"type"
,
"text"
);
}
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 16:42 (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1199673
Default Alt Text
password-generate-button.stimulus.ts (632 B)
Attached To
Mode
rSGEN sealgen
Attached
Detach File
Event Timeline