@@ -8,7 +8,7 @@ use crate::models::{NewUser, User};
88use crate :: schema:: users;
99use crate :: util:: errors:: { CargoError , ReadOnlyMode } ;
1010
11- /// Handles the `GET /authorize_url ` route.
11+ /// Handles the `GET /api/private/session/begin ` route.
1212///
1313/// This route will return an authorization URL for the GitHub OAuth flow including the crates.io
1414/// `client_id` and a randomly generated `state` secret.
@@ -23,7 +23,7 @@ use crate::util::errors::{CargoError, ReadOnlyMode};
2323/// "url": "https://github.com/login/oauth/authorize?client_id=...&state=...&scope=read%3Aorg"
2424/// }
2525/// ```
26- pub fn github_authorize ( req : & mut dyn Request ) -> CargoResult < Response > {
26+ pub fn begin ( req : & mut dyn Request ) -> CargoResult < Response > {
2727 let ( url, state) = req
2828 . app ( )
2929 . github
@@ -43,7 +43,7 @@ pub fn github_authorize(req: &mut dyn Request) -> CargoResult<Response> {
4343 } ) )
4444}
4545
46- /// Handles the `GET /authorize` route.
46+ /// Handles the `GET /api/private/session/ authorize` route.
4747///
4848/// This route is called from the GitHub API OAuth flow after the user accepted or rejected
4949/// the data access permissions. It will check the `state` parameter and then call the GitHub API
@@ -71,7 +71,7 @@ pub fn github_authorize(req: &mut dyn Request) -> CargoResult<Response> {
7171/// }
7272/// }
7373/// ```
74- pub fn github_access_token ( req : & mut dyn Request ) -> CargoResult < Response > {
74+ pub fn authorize ( req : & mut dyn Request ) -> CargoResult < Response > {
7575 // Parse the url query
7676 let mut query = req. query ( ) ;
7777 let code = query. remove ( "code" ) . unwrap_or_default ( ) ;
@@ -141,7 +141,7 @@ impl GithubUser {
141141 }
142142}
143143
144- /// Handles the `GET /logout ` route.
144+ /// Handles the `DELETE /api/private/session ` route.
145145pub fn logout ( req : & mut dyn Request ) -> CargoResult < Response > {
146146 req. session ( ) . remove ( & "user_id" . to_string ( ) ) ;
147147 Ok ( req. json ( & true ) )
0 commit comments