@@ -10,7 +10,7 @@ use crate::models::{NewUser, User};
10
10
use crate :: schema:: users;
11
11
use crate :: util:: errors:: { AppError , ReadOnlyMode } ;
12
12
13
- /// Handles the `GET /authorize_url ` route.
13
+ /// Handles the `GET /api/private/session/begin ` route.
14
14
///
15
15
/// This route will return an authorization URL for the GitHub OAuth flow including the crates.io
16
16
/// `client_id` and a randomly generated `state` secret.
@@ -25,7 +25,7 @@ use crate::util::errors::{AppError, ReadOnlyMode};
25
25
/// "url": "https://github.com/login/oauth/authorize?client_id=...&state=...&scope=read%3Aorg"
26
26
/// }
27
27
/// ```
28
- pub fn github_authorize ( req : & mut dyn Request ) -> AppResult < Response > {
28
+ pub fn begin ( req : & mut dyn Request ) -> AppResult < Response > {
29
29
let ( url, state) = req
30
30
. app ( )
31
31
. github
@@ -45,7 +45,7 @@ pub fn github_authorize(req: &mut dyn Request) -> AppResult<Response> {
45
45
} ) )
46
46
}
47
47
48
- /// Handles the `GET /authorize` route.
48
+ /// Handles the `GET /api/private/session/ authorize` route.
49
49
///
50
50
/// This route is called from the GitHub API OAuth flow after the user accepted or rejected
51
51
/// the data access permissions. It will check the `state` parameter and then call the GitHub API
@@ -73,7 +73,7 @@ pub fn github_authorize(req: &mut dyn Request) -> AppResult<Response> {
73
73
/// }
74
74
/// }
75
75
/// ```
76
- pub fn github_access_token ( req : & mut dyn Request ) -> AppResult < Response > {
76
+ pub fn authorize ( req : & mut dyn Request ) -> AppResult < Response > {
77
77
// Parse the url query
78
78
let mut query = req. query ( ) ;
79
79
let code = query. remove ( "code" ) . unwrap_or_default ( ) ;
@@ -144,7 +144,7 @@ impl GithubUser {
144
144
}
145
145
}
146
146
147
- /// Handles the `GET /logout ` route.
147
+ /// Handles the `DELETE /api/private/session ` route.
148
148
pub fn logout ( req : & mut dyn Request ) -> AppResult < Response > {
149
149
req. session ( ) . remove ( & "user_id" . to_string ( ) ) ;
150
150
Ok ( req. json ( & true ) )
0 commit comments