-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4.0] Restore com_admin profile view (#29251)
* Restore com_admin profile view * Restore language strings * Remove help site field * Simplify layout * Line length * Add return URL * Fix redirects * Move to src directory * Correct link * Fix TFA * Add back com_admin.profile context * CS * CS * CS Co-authored-by: Quy <quy@fluxbb.org> * Use com_users form * Restore string * Revert "Restore string" This reverts commit 7228688. * Revert "Use com_users form" This reverts commit da295c1. * Use com_admin form * Map com_admin.profile context * Missing strings * Rename strings * Missing string * Alpha sort * TFA switcher * Cleanup * Add password meter * Remove unused string Co-authored-by: Quy <quy@fluxbb.org>
- Loading branch information
Showing
11 changed files
with
665 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<form> | ||
<fieldset | ||
name="user_details" | ||
label="COM_ADMIN_PROFILE_FIELDSET_USER_DETAILS_LABEL" | ||
> | ||
<field | ||
name="name" | ||
type="text" | ||
label="COM_ADMIN_PROFILE_HEADING_NAME" | ||
required="true" | ||
size="30" | ||
/> | ||
|
||
<field | ||
name="username" | ||
type="text" | ||
label="COM_ADMIN_PROFILE_FIELD_USERNAME_LABEL" | ||
required="true" | ||
size="30" | ||
/> | ||
|
||
<field | ||
name="password" | ||
type="password" | ||
label="JGLOBAL_PASSWORD" | ||
autocomplete="new-password" | ||
class="validate-password-strength" | ||
filter="raw" | ||
validate="password" | ||
strengthmeter="true" | ||
force="on" | ||
size="30" | ||
/> | ||
|
||
<field | ||
name="password2" | ||
type="password" | ||
label="COM_ADMIN_PROFILE_FIELD_PASSWORD2_LABEL" | ||
autocomplete="new-password" | ||
class="validate-passwordExtra" | ||
filter="raw" | ||
message="COM_ADMIN_PROFILE_FIELD_PASSWORD1_MESSAGE" | ||
size="30" | ||
validate="equals" | ||
field="password" | ||
/> | ||
|
||
<field | ||
name="email" | ||
type="email" | ||
label="JGLOBAL_EMAIL" | ||
class="validate-email" | ||
required="true" | ||
size="30" | ||
validate="email" | ||
/> | ||
|
||
<field | ||
name="registerDate" | ||
type="calendar" | ||
label="COM_ADMIN_PROFILE_FIELD_REGISTERDATE_LABEL" | ||
class="readonly" | ||
readonly="true" | ||
translateformat="true" | ||
showtime="true" | ||
size="22" | ||
filter="user_utc" | ||
/> | ||
|
||
<field | ||
name="lastvisitDate" | ||
type="calendar" | ||
label="COM_ADMIN_PROFILE_FIELD_LASTVISIT_LABEL" | ||
class="readonly" | ||
readonly="true" | ||
translateformat="true" | ||
showtime="true" | ||
size="22" | ||
filter="user_utc" | ||
/> | ||
|
||
<field | ||
name="id" | ||
type="number" | ||
label="JGLOBAL_FIELD_ID_LABEL" | ||
class="readonly" | ||
default="0" | ||
readonly="true" | ||
filter="unset" | ||
/> | ||
|
||
</fieldset> | ||
|
||
<fields name="params"> | ||
|
||
<fieldset | ||
name="settings" | ||
label="COM_ADMIN_PROFILE_FIELDSET_SETTINGS_LABEL" | ||
> | ||
<field | ||
name="admin_style" | ||
type="templatestyle" | ||
label="COM_ADMIN_PROFILE_FIELD_BACKEND_TEMPLATE_LABEL" | ||
client="administrator" | ||
filter="uint" | ||
> | ||
<option value="">JOPTION_USE_DEFAULT</option> | ||
</field> | ||
|
||
<field | ||
name="admin_language" | ||
type="language" | ||
label="COM_ADMIN_PROFILE_FIELD_BACKEND_LANGUAGE_LABEL" | ||
client="administrator" | ||
> | ||
<option value="">JOPTION_USE_DEFAULT</option> | ||
</field> | ||
|
||
<field | ||
name="language" | ||
type="language" | ||
label="COM_ADMIN_PROFILE_FIELD_FRONTEND_LANGUAGE_LABEL" | ||
client="site" | ||
> | ||
<option value="">JOPTION_USE_DEFAULT</option> | ||
</field> | ||
|
||
<field | ||
name="editor" | ||
type="plugins" | ||
label="COM_ADMIN_PROFILE_FIELD_EDITOR_LABEL" | ||
folder="editors" | ||
useaccess="true" | ||
> | ||
<option value="">JOPTION_USE_DEFAULT</option> | ||
</field> | ||
|
||
<field | ||
name="timezone" | ||
type="timezone" | ||
label="COM_ADMIN_PROFILE_FIELD_TIMEZONE_LABEL" | ||
> | ||
<option value="">JOPTION_USE_DEFAULT</option> | ||
</field> | ||
</fieldset> | ||
</fields> | ||
</form> |
102 changes: 102 additions & 0 deletions
102
administrator/components/com_admin/src/Controller/ProfileController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Administrator | ||
* @subpackage com_admin | ||
* | ||
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
namespace Joomla\Component\Admin\Administrator\Controller; | ||
|
||
\defined('_JEXEC') or die; | ||
|
||
use Joomla\CMS\MVC\Controller\FormController; | ||
use Joomla\CMS\Router\Route; | ||
use Joomla\CMS\Uri\Uri; | ||
|
||
/** | ||
* User profile controller class. | ||
* | ||
* @since 1.6 | ||
*/ | ||
class ProfileController extends FormController | ||
{ | ||
/** | ||
* Method to check if you can edit a record. | ||
* | ||
* Extended classes can override this if necessary. | ||
* | ||
* @param array $data An array of input data. | ||
* @param string $key The name of the key for the primary key. | ||
* | ||
* @return boolean | ||
* | ||
* @since 1.6 | ||
*/ | ||
protected function allowEdit($data = [], $key = 'id') | ||
{ | ||
return isset($data['id']) && $data['id'] == $this->app->getIdentity()->id; | ||
} | ||
|
||
/** | ||
* Overrides parent save method to check the submitted passwords match. | ||
* | ||
* @param string $key The name of the primary key of the URL variable. | ||
* @param string $urlVar The name of the URL variable if different from the primary key (sometimes required to avoid router collisions). | ||
* | ||
* @return boolean True if successful, false otherwise. | ||
* | ||
* @since 3.2 | ||
*/ | ||
public function save($key = null, $urlVar = null) | ||
{ | ||
$result = parent::save(); | ||
|
||
if ($this->getTask() !== 'apply') | ||
{ | ||
$return = base64_decode($this->input->get('return', '', 'BASE64')); | ||
|
||
if ($return !== '' && Uri::isInternal($return)) | ||
{ | ||
// Redirect to return URL. | ||
$this->setRedirect(Route::_($return, false)); | ||
} | ||
else | ||
{ | ||
// Redirect to the main page. | ||
$this->setRedirect(Route::_('index.php', false)); | ||
} | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
/** | ||
* Method to cancel an edit. | ||
* | ||
* @param string $key The name of the primary key of the URL variable. | ||
* | ||
* @return boolean True if access level checks pass, false otherwise. | ||
* | ||
* @since 1.6 | ||
*/ | ||
public function cancel($key = null) | ||
{ | ||
$result = parent::cancel($key); | ||
$return = base64_decode($this->input->get('return', '', 'BASE64')); | ||
|
||
if ($return !== '' && Uri::isInternal($return)) | ||
{ | ||
// Redirect to return URL. | ||
$this->setRedirect(Route::_($return, false)); | ||
} | ||
else | ||
{ | ||
// Redirect to the main page. | ||
$this->setRedirect(Route::_('index.php', false)); | ||
} | ||
|
||
return $result; | ||
} | ||
} |
Oops, something went wrong.