22< html >
33< head >
44 < title > Ldnode: Admin Signup</ title >
5- </ head >
65
6+ < style >
7+ body {
8+ font-family : sans-serif;
9+ }
10+ input {
11+ width : 200px ;
12+ line-height : 1.5em ;
13+ padding : 5px ;
14+ font-size : 1.2em ;
15+ border-radius : 4px ;
16+ margin-bottom : 10px ;
17+ }
18+
19+ button {
20+ display : inline-block;
21+ padding : 25px ;
22+ background : # 69f ;
23+ border-radius : 4px ;
24+ font-weight : normal;
25+ font-size : 14px ;
26+ color : # fff ;
27+ letter-spacing : 1px ;
28+ line-height : 1px ;
29+ text-transform : uppercase;
30+ border : 0 ;
31+ }
32+ </ style >
33+
34+ </ head >
735< body >
836
9- < form id ="accounts ">
10- < input type ="email ">
11- </ form >
1237
13- < form id ="cert " method ="POST " action ='/accounts/cert ' target ="spkacResult ">
14- < keygen name ="spkac " >
15- < input name ="webid ">
16- < button onclick ='createGen() '> </ button >
38+ < div id ="accounts ">
39+ < h2 > Create your local account.</ h2 >
40+ < input id ="name " type ="name " placeholder ="Your name ">
41+ < br >
42+ < input id ="email " type ="email " placeholder ="Recovery email ">
43+ < br >
44+ < button onclick ='createAccount() '> Create account</ button >
45+ </ div >
46+
47+ < form id ="cert " method ="POST " action ='/accounts/cert ' target ="spkacResult " style ="display: none ">
48+ < h2 > Finish by issuing credentials in the form of a certificate</ h2 >
49+ < keygen name ="spkac " hidden >
50+ < p > Your WebID is: < span id ="webid "> </ span > </ p >
51+ < br >
52+ < button onclick ='createGen() '> Issue credentials</ button >
1753</ form >
1854
1955< script type ="text/javascript ">
2056
21- var email = document . querySelector ( "#email" ) . value
22-
23- function createAccount ( email , callback ) {
24- var hostname = location . hostname
57+ function createAccount ( ) {
58+ var email = document . querySelector ( "#email" ) . value
59+ var hostname = location . hostname
2560 var url = '/accounts/new'
2661 var data = "email=" + email ;
2762
3267 http . onreadystatechange = function ( ) {
3368 if ( this . readyState !== this . DONE
3469 || this . status !== 200 ) {
35- return callback ( new Error ( 'Request failed' ) )
70+ return done ( new Error ( 'Request failed' ) )
3671 }
3772 var webid = this . getResponseHeader ( "User" )
3873 if ( ! webid || webid . length === 0 ) {
39- return callback ( new Error ( 'WebID is not set in User' ) )
74+ return done ( new Error ( 'WebID is not set in User' ) )
4075 }
4176
42- callback ( null , webid )
77+
4378 // Account is created
4479 }
45- http . send ( data ) ;
80+ http . send ( data )
4681}
4782
4883function createGen ( ) {
6196}
6297
6398document . querySelector ( '#cert' ) . style . display = 'none'
64- createAccount ( email , function ( err , webid ) {
99+
100+ function done ( err ) {
101+ if ( err ) {
102+ console . log ( err )
103+ }
65104 document . querySelector ( '#accounts' ) . style . display = 'none'
66105 document . querySelector ( '#cert' ) . style . display = ''
67106 document . querySelector ( '#webid' ) . value = webid
68- } )
107+ }
108+
69109</ script >
70110</ body >
71111</ html >
0 commit comments