-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
46 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//! Logout controller. | ||
use rwf::prelude::*; | ||
|
||
/// Log the user out. | ||
pub struct LogoutController { | ||
redirect: String, | ||
} | ||
|
||
impl LogoutController { | ||
/// Redirect user to this URL after logging out. | ||
pub fn redirect(redirect: impl ToString) -> Self { | ||
Self { | ||
redirect: redirect.to_string(), | ||
} | ||
} | ||
} | ||
|
||
impl Default for LogoutController { | ||
fn default() -> Self { | ||
Self { | ||
redirect: "/".to_string(), | ||
} | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl Controller for LogoutController { | ||
async fn handle(&self, request: &Request) -> Result<Response, Error> { | ||
Ok(request.logout().redirect(self.redirect.clone())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// This file is automatically generated by rwf-cli. | ||
// Manual modifications to this file will not be preserved. | ||
pub mod logout; | ||
pub mod password; | ||
|
||
pub use password::{Password, PasswordController}; | ||
pub use logout::LogoutController; | ||
pub use password::PasswordController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters