File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,8 @@ pub async fn authorize(
86
86
let app_clone = app. clone ( ) ;
87
87
let request_log = req. request_log ( ) . clone ( ) ;
88
88
89
- spawn_blocking ( move || {
89
+ let conn = app. db_write_async ( ) . await ?;
90
+ conn. interact ( move |conn| {
90
91
// Make sure that the state we just got matches the session state that we
91
92
// should have issued earlier.
92
93
let session_state = session. remove ( "github_oauth_state" ) . map ( CsrfToken :: new) ;
@@ -108,15 +109,14 @@ pub async fn authorize(
108
109
109
110
// Fetch the user info from GitHub using the access token we just got and create a user record
110
111
let ghuser = Handle :: current ( ) . block_on ( app. github . current_user ( token) ) ?;
111
- let user =
112
- save_user_to_database ( & ghuser, token. secret ( ) , & app. emails , & mut * app. db_write ( ) ?) ?;
112
+ let user = save_user_to_database ( & ghuser, token. secret ( ) , & app. emails , conn) ?;
113
113
114
114
// Log in by setting a cookie and the middleware authentication
115
115
session. insert ( "user_id" . to_string ( ) , user. id . to_string ( ) ) ;
116
116
117
117
Ok ( ( ) )
118
118
} )
119
- . await ?;
119
+ . await ?? ;
120
120
121
121
super :: me:: me ( app_clone, req) . await
122
122
}
You can’t perform that action at this time.
0 commit comments