@@ -8,7 +8,7 @@ use crate::models::{NewUser, User};
8
8
use crate :: schema:: users;
9
9
use crate :: util:: errors:: { CargoError , ReadOnlyMode } ;
10
10
11
- /// Handles the `GET /authorize_url ` route.
11
+ /// Handles the `GET /api/private/session/begin ` route.
12
12
///
13
13
/// This route will return an authorization URL for the GitHub OAuth flow including the crates.io
14
14
/// `client_id` and a randomly generated `state` secret.
@@ -23,7 +23,7 @@ use crate::util::errors::{CargoError, ReadOnlyMode};
23
23
/// "url": "https://github.com/login/oauth/authorize?client_id=...&state=...&scope=read%3Aorg"
24
24
/// }
25
25
/// ```
26
- pub fn github_authorize ( req : & mut dyn Request ) -> CargoResult < Response > {
26
+ pub fn begin ( req : & mut dyn Request ) -> CargoResult < Response > {
27
27
let ( url, state) = req
28
28
. app ( )
29
29
. github
@@ -43,7 +43,7 @@ pub fn github_authorize(req: &mut dyn Request) -> CargoResult<Response> {
43
43
} ) )
44
44
}
45
45
46
- /// Handles the `GET /authorize` route.
46
+ /// Handles the `GET /api/private/session/ authorize` route.
47
47
///
48
48
/// This route is called from the GitHub API OAuth flow after the user accepted or rejected
49
49
/// 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> {
71
71
/// }
72
72
/// }
73
73
/// ```
74
- pub fn github_access_token ( req : & mut dyn Request ) -> CargoResult < Response > {
74
+ pub fn authorize ( req : & mut dyn Request ) -> CargoResult < Response > {
75
75
// Parse the url query
76
76
let mut query = req. query ( ) ;
77
77
let code = query. remove ( "code" ) . unwrap_or_default ( ) ;
@@ -141,7 +141,7 @@ impl GithubUser {
141
141
}
142
142
}
143
143
144
- /// Handles the `GET /logout ` route.
144
+ /// Handles the `DELETE /api/private/session ` route.
145
145
pub fn logout ( req : & mut dyn Request ) -> CargoResult < Response > {
146
146
req. session ( ) . remove ( & "user_id" . to_string ( ) ) ;
147
147
Ok ( req. json ( & true ) )
0 commit comments