<?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 $tS15v) { goto AtDTf; AtDTf: $aDbJm = new Form(DynamicModel::class); goto pXVev; vhZBu: $aDbJm->password('passwordRepeat', L('Repeat Password'))->rules('required'); goto K3g_X; K3g_X: if (Request::isPost()) { AdminPermission::demoCheck(); return $aDbJm->formRequest(function (Form $aDbJm) { $CnWtd = $aDbJm->dataForming(); ResultException::throwsIf(L('New Password Not Match'), $CnWtd['passwordNew'] != $CnWtd['passwordRepeat']); $f3Nqc = Admin::changePassword(Admin::id(), $CnWtd['password'], $CnWtd['passwordNew']); ResultException::throwsIfFail($f3Nqc); Admin::addInfoLog(Admin::id(), L('Change password')); return Response::json(0, L('Password change correct, please relogin'), null, modstart_admin_url('logout')); }); } goto OzrUu; pXVev: $aDbJm->password('password', L('Password'))->rules('required'); goto Sej2U; OzrUu: return $tS15v->pageTitle(L('Change Password'))->row(function (Row $tMM4T) use($aDbJm) { $tMM4T->column(6, new Box($aDbJm, L('Change Password'))); }); goto Nc06C; Sej2U: $aDbJm->password('passwordNew', L('New Password'))->rules('required'); goto vhZBu; Nc06C: } }