<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace ModStart\Admin\Controller; use Illuminate\Routing\Controller; use ModStart\Admin\Auth\Admin; use ModStart\Admin\Auth\AdminPermission; use ModStart\Admin\Layout\AdminPage; use ModStart\Core\Dao\DynamicModel; use ModStart\Core\Exception\ResultException; use ModStart\Core\Input\Request; use ModStart\Core\Input\Response; use ModStart\Form\Form; use ModStart\Layout\Row; use ModStart\Widget\Box; class ProfileController extends Controller { public function changePassword(AdminPage $h9DVl) { goto wRtF6; a4_nC: $yfPYJ->password('password', L('Password'))->rules('required'); goto plUYM; h6hl5: if (Request::isPost()) { AdminPermission::demoCheck(); return $yfPYJ->formRequest(function (Form $yfPYJ) { $zonFp = $yfPYJ->dataForming(); ResultException::throwsIf(L('New Password Not Match'), $zonFp['passwordNew'] != $zonFp['passwordRepeat']); $Z5nZL = Admin::changePassword(Admin::id(), $zonFp['password'], $zonFp['passwordNew']); ResultException::throwsIfFail($Z5nZL); Admin::addInfoLog(Admin::id(), L('Change password')); return Response::json(0, L('Password change correct, please relogin'), null, modstart_admin_url('logout')); }); } goto ZEygb; plUYM: $yfPYJ->password('passwordNew', L('New Password'))->rules('required'); goto Xp6Go; ZEygb: return $h9DVl->pageTitle(L('Change Password'))->row(function (Row $EzOZh) use($yfPYJ) { $EzOZh->column(6, new Box($yfPYJ, L('Change Password'))); }); goto JjSg_; Xp6Go: $yfPYJ->password('passwordRepeat', L('Repeat Password'))->rules('required'); goto h6hl5; wRtF6: $yfPYJ = new Form(DynamicModel::class); goto a4_nC; JjSg_: } }