1
1
use crate :: db:: DbPool ;
2
- use chrono:: Utc ;
2
+ use chrono:: { SecondsFormat , Utc } ;
3
3
use rocket:: serde:: json:: Json ;
4
4
use serde_json:: Value ;
5
5
@@ -1123,7 +1123,7 @@ async fn post_auth_request(
1123
1123
"requestIpAddress" : auth_request. request_ip,
1124
1124
"key" : null,
1125
1125
"masterPasswordHash" : null,
1126
- "creationDate" : auth_request. creation_date. and_utc( ) ,
1126
+ "creationDate" : auth_request. creation_date. and_utc( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ,
1127
1127
"responseDate" : null,
1128
1128
"requestApproved" : false ,
1129
1129
"origin" : CONFIG . domain_origin( ) ,
@@ -1140,7 +1140,9 @@ async fn get_auth_request(uuid: &str, mut conn: DbConn) -> JsonResult {
1140
1140
}
1141
1141
} ;
1142
1142
1143
- let response_date_utc = auth_request. response_date . map ( |response_date| response_date. and_utc ( ) ) ;
1143
+ let response_date_utc = auth_request
1144
+ . response_date
1145
+ . map ( |response_date| response_date. and_utc ( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ) ;
1144
1146
1145
1147
Ok ( Json ( json ! (
1146
1148
{
@@ -1150,7 +1152,7 @@ async fn get_auth_request(uuid: &str, mut conn: DbConn) -> JsonResult {
1150
1152
"requestIpAddress" : auth_request. request_ip,
1151
1153
"key" : auth_request. enc_key,
1152
1154
"masterPasswordHash" : auth_request. master_password_hash,
1153
- "creationDate" : auth_request. creation_date. and_utc( ) ,
1155
+ "creationDate" : auth_request. creation_date. and_utc( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ,
1154
1156
"responseDate" : response_date_utc,
1155
1157
"requestApproved" : auth_request. approved,
1156
1158
"origin" : CONFIG . domain_origin( ) ,
@@ -1195,7 +1197,9 @@ async fn put_auth_request(
1195
1197
nt. send_auth_response ( & auth_request. user_uuid , & auth_request. uuid , data. device_identifier , & mut conn) . await ;
1196
1198
}
1197
1199
1198
- let response_date_utc = auth_request. response_date . map ( |response_date| response_date. and_utc ( ) ) ;
1200
+ let response_date_utc = auth_request
1201
+ . response_date
1202
+ . map ( |response_date| response_date. and_utc ( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ) ;
1199
1203
1200
1204
Ok ( Json ( json ! (
1201
1205
{
@@ -1205,7 +1209,7 @@ async fn put_auth_request(
1205
1209
"requestIpAddress" : auth_request. request_ip,
1206
1210
"key" : auth_request. enc_key,
1207
1211
"masterPasswordHash" : auth_request. master_password_hash,
1208
- "creationDate" : auth_request. creation_date. and_utc( ) ,
1212
+ "creationDate" : auth_request. creation_date. and_utc( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ,
1209
1213
"responseDate" : response_date_utc,
1210
1214
"requestApproved" : auth_request. approved,
1211
1215
"origin" : CONFIG . domain_origin( ) ,
@@ -1227,7 +1231,9 @@ async fn get_auth_request_response(uuid: &str, code: &str, mut conn: DbConn) ->
1227
1231
err ! ( "Access code invalid doesn't exist" )
1228
1232
}
1229
1233
1230
- let response_date_utc = auth_request. response_date . map ( |response_date| response_date. and_utc ( ) ) ;
1234
+ let response_date_utc = auth_request
1235
+ . response_date
1236
+ . map ( |response_date| response_date. and_utc ( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ) ;
1231
1237
1232
1238
Ok ( Json ( json ! (
1233
1239
{
@@ -1237,7 +1243,7 @@ async fn get_auth_request_response(uuid: &str, code: &str, mut conn: DbConn) ->
1237
1243
"requestIpAddress" : auth_request. request_ip,
1238
1244
"key" : auth_request. enc_key,
1239
1245
"masterPasswordHash" : auth_request. master_password_hash,
1240
- "creationDate" : auth_request. creation_date. and_utc( ) ,
1246
+ "creationDate" : auth_request. creation_date. and_utc( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ,
1241
1247
"responseDate" : response_date_utc,
1242
1248
"requestApproved" : auth_request. approved,
1243
1249
"origin" : CONFIG . domain_origin( ) ,
@@ -1255,7 +1261,7 @@ async fn get_auth_requests(headers: Headers, mut conn: DbConn) -> JsonResult {
1255
1261
. iter( )
1256
1262
. filter( |request| request. approved. is_none( ) )
1257
1263
. map( |request| {
1258
- let response_date_utc = request. response_date. map( |response_date| response_date. and_utc( ) ) ;
1264
+ let response_date_utc = request. response_date. map( |response_date| response_date. and_utc( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ) ;
1259
1265
1260
1266
json!( {
1261
1267
"id" : request. uuid,
@@ -1264,7 +1270,7 @@ async fn get_auth_requests(headers: Headers, mut conn: DbConn) -> JsonResult {
1264
1270
"requestIpAddress" : request. request_ip,
1265
1271
"key" : request. enc_key,
1266
1272
"masterPasswordHash" : request. master_password_hash,
1267
- "creationDate" : request. creation_date. and_utc( ) ,
1273
+ "creationDate" : request. creation_date. and_utc( ) . to_rfc3339_opts ( SecondsFormat :: Micros , true ) ,
1268
1274
"responseDate" : response_date_utc,
1269
1275
"requestApproved" : request. approved,
1270
1276
"origin" : CONFIG . domain_origin( ) ,
0 commit comments