File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import SotoCognitoIdentity
88enum ForgotPasswordController {
99 @Sendable
1010 static func show( req: Request ) async throws -> HTML {
11- return ForgotPassword . View ( path: req. url. path) . document ( )
11+ return ForgotPassword . View ( path: req. url. path, model : ForgotPassword . Model ( ) ) . document ( )
1212 }
1313
1414 @Sendable
@@ -21,8 +21,7 @@ enum ForgotPasswordController {
2121 try await req. application. cognito. authenticatable. forgotPassword ( username: user. email)
2222 return Reset . View ( path: SiteURL . resetPassword. relativeURL ( ) , model: Reset . Model ( email: user. email) ) . document ( )
2323 } catch {
24- // TODO: handle this
25- return Reset . View ( path: SiteURL . resetPassword. relativeURL ( ) , model: Reset . Model ( email: user. email) ) . document ( )
24+ return ForgotPassword . View ( path: req. url. path, model: ForgotPassword . Model ( errorMessage: " There was an error. Please try again. " ) ) . document ( )
2625 }
2726 }
2827}
Original file line number Diff line number Diff line change @@ -3,8 +3,19 @@ import Foundation
33
44enum ForgotPassword {
55
6+ struct Model {
7+ var errorMessage : String = " "
8+ }
9+
610 class View : PublicPage {
711
12+ let model : Model
13+
14+ init ( path: String , model: Model ) {
15+ self . model = model
16+ super. init ( path: path)
17+ }
18+
819 override func pageTitle( ) -> String ? {
920 " Forgot Password "
1021 }
@@ -13,7 +24,8 @@ enum ForgotPassword {
1324 . div(
1425 . class( " manage-page " ) ,
1526 . h2( " An email will be sent with a reset code " ) ,
16- . forgotPasswordForm( )
27+ . forgotPasswordForm( ) ,
28+ . text( model. errorMessage)
1729 )
1830 }
1931 }
You can’t perform that action at this time.
0 commit comments