<?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 $y7QFs) { goto EanPf; xX_40: if (Request::isPost()) { AdminPermission::demoCheck(); return $wDk8k->formRequest(function (Form $wDk8k) { $Sj05q = $wDk8k->dataForming(); ResultException::throwsIf(L('New Password Not Match'), $Sj05q['passwordNew'] != $Sj05q['passwordRepeat']); $N2Xaa = Admin::changePassword(Admin::id(), $Sj05q['password'], $Sj05q['passwordNew']); ResultException::throwsIfFail($N2Xaa); Admin::addInfoLog(Admin::id(), L('Change password')); return Response::json(0, L('Password change correct, please relogin'), null, modstart_admin_url('logout')); }); } goto UBPUf; EanPf: $wDk8k = new Form(DynamicModel::class); goto wrpdx; OW2Q3: $wDk8k->password('passwordNew', L('New Password'))->rules('required'); goto ROW94; ROW94: $wDk8k->password('passwordRepeat', L('Repeat Password'))->rules('required'); goto xX_40; wrpdx: $wDk8k->password('password', L('Password'))->rules('required'); goto OW2Q3; UBPUf: return $y7QFs->pageTitle(L('Change Password'))->row(function (Row $KWrRN) use($wDk8k) { $KWrRN->column(6, new Box($wDk8k, L('Change Password'))); }); goto slPBw; slPBw: } }