@@ -25,7 +25,7 @@ Table of contents
25
25
Usage
26
26
-----
27
27
28
- Attach [ fairing] ( https://rocket.rs/v0.4 /guide/fairings/#fairings ) to the Rocket
28
+ Attach [ fairing] ( https://rocket.rs/v0.5-rc /guide/fairings/#fairings ) to the Rocket
29
29
instance:
30
30
31
31
``` rust
@@ -46,7 +46,7 @@ fn rocket() -> _ {
46
46
```
47
47
48
48
You also can configure
49
- [ fairing] ( https://rocket.rs/v0.4 /guide/fairings/#fairings ) :
49
+ [ fairing] ( https://rocket.rs/v0.5-rc /guide/fairings/#fairings ) :
50
50
51
51
``` rust
52
52
#[launch]
@@ -63,7 +63,7 @@ fn rocket() -> _ {
63
63
}
64
64
```
65
65
66
- Add [ guard] ( https://rocket.rs/v0.4 /guide/requests/#request-guards ) to any
66
+ Add [ guard] ( https://rocket.rs/v0.5-rc /guide/requests/#request-guards ) to any
67
67
request where you want to have access to session's CSRF token (e.g. to include
68
68
it in forms) or verify it (e.g. to validate form):
69
69
@@ -85,8 +85,8 @@ fn create(csrf_token: CsrfToken, form: Form<Comment>) -> Redirect {
85
85
```
86
86
87
87
Get CSRF token from
88
- [ guard] ( https://rocket.rs/v0.4 /guide/requests/#request-guards )
89
- to use it in [ templates] ( https://rocket.rs/v0.4 /guide/responses/#templates ) :
88
+ [ guard] ( https://rocket.rs/v0.5-rc /guide/requests/#request-guards )
89
+ to use it in [ templates] ( https://rocket.rs/v0.5-rc /guide/responses/#templates ) :
90
90
91
91
``` rust
92
92
#[get(" /comments/new" )]
@@ -98,7 +98,7 @@ fn new(csrf_token: CsrfToken) -> Template {
98
98
```
99
99
100
100
Add CSRF token to your HTML forms in
101
- [ templates] ( https://rocket.rs/v0.4 /guide/responses/#templates ) :
101
+ [ templates] ( https://rocket.rs/v0.5-rc /guide/responses/#templates ) :
102
102
103
103
``` html
104
104
<form method =" post" action =" /comments" >
@@ -108,7 +108,7 @@ Add CSRF token to your HTML forms in
108
108
```
109
109
110
110
Add attribute ` authenticity_token ` to your
111
- [ forms] ( https://rocket.rs/v0.4 /guide/requests/#forms ) :
111
+ [ forms] ( https://rocket.rs/v0.5-rc /guide/requests/#forms ) :
112
112
113
113
``` rust
114
114
#[derive(FromForm )]
@@ -118,7 +118,7 @@ struct Comment {
118
118
}
119
119
```
120
120
121
- Validate [ forms] ( https://rocket.rs/v0.4 /guide/requests/#forms ) to have valid
121
+ Validate [ forms] ( https://rocket.rs/v0.5-rc /guide/requests/#forms ) to have valid
122
122
authenticity token:
123
123
124
124
``` rust
140
140
----
141
141
142
142
* [ ] Add fairing to verify all requests as an option.
143
- * [ ] Add [ data guard] ( https://api.rocket.rs/v0.4 /rocket/data/trait.FromData.html ) to verify forms with a guard.
143
+ * [ ] Add [ data guard] ( https://api.rocket.rs/v0.5-rc /rocket/data/trait.FromData.html ) to verify forms with a guard.
144
144
* [ ] Add helpers to render form field.
145
145
* [ ] Add helpers to add HTML meta tags for Ajax with ` X-CSRF-Token ` header.
146
146
* [ ] Verify ` X-CSRF-Token ` header.
0 commit comments