File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
demos/credential-management Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -73,10 +73,18 @@ <h2>Sign Up!</h2>
73
73
document . querySelector ( '#signup' ) . addEventListener ( 'submit' , function ( e ) {
74
74
if ( navigator . credentials ) {
75
75
console . log ( "Creating credentials!" ) ;
76
- var c = new PasswordCredential ( {
77
- id : document . querySelector ( '#username-signup' ) . value ,
78
- password : document . querySelector ( '#password-signup' ) . value
79
- } ) ;
76
+ var c ;
77
+ try {
78
+ c = new PasswordCredential ( {
79
+ id : document . querySelector ( '#username-signup' ) . value ,
80
+ password : document . querySelector ( '#password-signup' ) . value
81
+ } ) ;
82
+ } catch ( e ) {
83
+ c = new PasswordCredential (
84
+ document . querySelector ( '#username-signup' ) . value ,
85
+ document . querySelector ( '#password-signup' ) . value
86
+ ) ;
87
+ }
80
88
navigator . credentials . store ( c ) . then ( function ( ) {
81
89
console . log ( "Stored credential!" ) ;
82
90
} ) ;
You can’t perform that action at this time.
0 commit comments