@@ -51,11 +51,18 @@ public function __construct(
5151 #[NoAdminRequired]
5252 #[NoCSRFRequired]
5353 public function showVerifyMail (string $ token , string $ userId , string $ key ): TemplateResponse {
54- if ($ this ->userSession ->getUser ()->getUID () !== $ userId ) {
55- // not a public page, hence getUser() must return an IUser
56- throw new InvalidArgumentException ('Logged in account is not mail address owner ' );
54+ try {
55+ if ($ this ->userSession ->getUser ()?->getUID() !== $ userId ) {
56+ // not a public page, hence getUser() must return an IUser
57+ throw new InvalidArgumentException ($ this ->l10n ->t ('Logged in account is not mail address owner ' ));
58+ }
59+ $ email = $ this ->crypto ->decrypt ($ key );
60+ } catch (\Exception $ e ) {
61+ return new TemplateResponse (
62+ 'core ' , 'error ' , [
63+ 'errors ' => [['error ' => $ e ->getMessage ()]]
64+ ], TemplateResponse::RENDER_AS_GUEST );
5765 }
58- $ email = $ this ->crypto ->decrypt ($ key );
5966
6067 return new TemplateResponse (
6168 'core ' , 'confirmation ' , [
@@ -73,8 +80,8 @@ public function showVerifyMail(string $token, string $userId, string $key): Temp
7380 public function verifyMail (string $ token , string $ userId , string $ key ): TemplateResponse {
7481 $ throttle = false ;
7582 try {
76- if ($ this ->userSession ->getUser ()->getUID () !== $ userId ) {
77- throw new InvalidArgumentException ('Logged in account is not mail address owner ' );
83+ if ($ this ->userSession ->getUser ()? ->getUID() !== $ userId ) {
84+ throw new InvalidArgumentException ($ this -> l10n -> t ( 'Logged in account is not mail address owner ' ) );
7885 }
7986 $ email = $ this ->crypto ->decrypt ($ key );
8087 $ ref = \substr (hash ('sha256 ' , $ email ), 0 , 8 );
0 commit comments