You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This project tries to cover most of PHP features in a simple MVC structure without installing composer packages. Then developers can use packages for specific requirements. Please add your ideas in Discussions or report bugs in issues.
5
+
> This project tries to cover most of PHP features in a simple MVC structure with minimum installed composer packages. Then developers can use packages for specific requirements. Please add your ideas in Discussions or report bugs in issues.
Helper::mailto($request->email, 'Welcome to PHPMVC! Your API secret key', '<p>Hi dear friend,</p><hr /><p>This is your API secret key to access authenticated API routes:</p><p><strong>' . $secret . '</strong></p><p>Please keep it in a safe place.</p><hr /><p>Good luck,</p><p><a href="http://localhost:8080" target="_blank" rel="noopener">PPMVC</a></p>');
64
+
Helper::mailto($request->email, 'Welcome to PHPMVC! Email Verification', '<p>Hi dear friend,</p><hr /><p>Please click on this link to verify your email</p><hr /><p>Good luck,</p><p><a href="http://localhost:8080?email=' . $request->email . '&user_token=' . $user_token . '" target="_blank" rel="noopener">Verify your email at PHPMVC</a></p>');
65
+
66
+
setcookie('message', 'Verification has been sent to your email, please check your inbox.', time() + 60);
62
67
} else {
63
68
$output['status'] = 'ERROR';
64
69
$output['message'] = 'There is an error! Please try again.';
@@ -68,6 +73,33 @@ public function register()
68
73
echojson_encode($output);
69
74
}
70
75
76
+
/**
77
+
* Email verification
78
+
*
79
+
* @return void
80
+
*/
81
+
publicfunctionverify()
82
+
{
83
+
$request = json_decode(json_encode($_POST));
84
+
85
+
if (Auth::verify($request) && $secret = Auth::getSecret($request)) {
86
+
Helper::mailto($request->email, 'PHPMVC! Your API secret key', '<p>Hi dear friend,</p><hr /><p>This is your API secret key to access authenticated API routes:</p><p><strong>' . $secret . '</strong></p><p>Please keep it in a safe place.</p><hr /><p>Good luck,</p><p><a href="http://localhost:8080" target="_blank" rel="noopener">PHPMVC</a></p>');
87
+
88
+
setcookie('message', 'Thanks for verification. Now you can publish a post!', time() + 60);
89
+
90
+
header('location: ' . URL_ROOT, true, 303);
91
+
exit();
92
+
} else {
93
+
Helper::render(
94
+
'Auth/verify',
95
+
[
96
+
'page_title' => 'Email Verification',
97
+
'page_subtitle' => 'Verification process failed! Please register again with a new email address.'
0 commit comments