diff --git a/routes/web.php b/routes/web.php index 0839506aa7c..b92cb349fd8 100755 --- a/routes/web.php +++ b/routes/web.php @@ -34,6 +34,7 @@ Route::post('login', 'UserController@login')->name('login'); Route::get('logout', 'UserController@logout')->name('logout'); Route::post('register', 'UserController@register')->name('register'); + Route::post('update', 'UserController@update')->name('user.update'); Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail')->name('password.email'); Route::get('password/reset/{token}', 'ResetPasswordController@showResetForm')->name('password.reset'); diff --git a/src/Auth/UserTags.php b/src/Auth/UserTags.php index d1c1c30fdea..051a1ca7dd7 100644 --- a/src/Auth/UserTags.php +++ b/src/Auth/UserTags.php @@ -276,6 +276,42 @@ public function resetPasswordForm() return $html; } + /** + * Output a update form. + * + * Maps to {{ user:update_form }} + * + * @return string + */ + public function updateForm() + { + if (session()->has('status')) { + return $this->parse(['success' => true]); + } + + $data = $this->getFormSession(); + + if (! $this->params->has('redirect')) { + $this->params->put('redirect', request()->getPathInfo()); + } + + $knownParams = ['redirect']; + + $html = $this->formOpen(route('statamic.user.update'), 'POST', $knownParams); + + $html .= ''; + + if ($redirect = $this->params->get('redirect')) { + $html .= ''; + } + + $html .= $this->parse($data); + + $html .= $this->formClose(); + + return $html; + } + /** * Displays content if a user has permission. * @@ -424,7 +460,7 @@ public function notIn() } /** - * {@inheritdoc} + * @inheritdoc */ public function eventUrl($url, $relative = false) {