File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 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(
8686 let app_clone = app. clone ( ) ;
8787 let request_log = req. request_log ( ) . clone ( ) ;
8888
89- spawn_blocking ( move || {
89+ let conn = app. db_write_async ( ) . await ?;
90+ conn. interact ( move |conn| {
9091 // Make sure that the state we just got matches the session state that we
9192 // should have issued earlier.
9293 let session_state = session. remove ( "github_oauth_state" ) . map ( CsrfToken :: new) ;
@@ -108,15 +109,14 @@ pub async fn authorize(
108109
109110 // Fetch the user info from GitHub using the access token we just got and create a user record
110111 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) ?;
113113
114114 // Log in by setting a cookie and the middleware authentication
115115 session. insert ( "user_id" . to_string ( ) , user. id . to_string ( ) ) ;
116116
117117 Ok ( ( ) )
118118 } )
119- . await ?;
119+ . await ?? ;
120120
121121 super :: me:: me ( app_clone, req) . await
122122}
You can’t perform that action at this time.
0 commit comments