<?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 $T7_dp) { goto xxLLM; s_nwc: $dBWZm->password('password', L('Password'))->rules('required'); goto S9keJ; pMFub: return $T7_dp->pageTitle(L('Change Password'))->row(function (Row $tEaF3) use($dBWZm) { $tEaF3->column(6, new Box($dBWZm, L('Change Password'))); }); goto g7QHF; bgnpx: $dBWZm->password('passwordRepeat', L('Repeat Password'))->rules('required'); goto tjx0K; xxLLM: $dBWZm = new Form(DynamicModel::class); goto s_nwc; tjx0K: if (Request::isPost()) { AdminPermission::demoCheck(); return $dBWZm->formRequest(function (Form $dBWZm) { $dTnlu = $dBWZm->dataForming(); ResultException::throwsIf(L('New Password Not Match'), $dTnlu['passwordNew'] != $dTnlu['passwordRepeat']); $bCCWW = Admin::changePassword(Admin::id(), $dTnlu['password'], $dTnlu['passwordNew']); ResultException::throwsIfFail($bCCWW); Admin::addInfoLog(Admin::id(), L('Change password')); return Response::json(0, L('Password change correct, please relogin'), null, modstart_admin_url('logout')); }); } goto pMFub; S9keJ: $dBWZm->password('passwordNew', L('New Password'))->rules('required'); goto bgnpx; g7QHF: } }