Update Page\Profile
Change the way links are generated.
This commit is contained in:
parent
2b936d3d3a
commit
41ec0c5400
6 changed files with 44 additions and 154 deletions
|
@ -73,7 +73,7 @@ class Config extends Profile
|
|||
'disp_posts' => 'Posts per page label',
|
||||
'ip_check_type' => 'IP check',
|
||||
])->addArguments([
|
||||
'token' => ['id' => $this->curUser->id],
|
||||
'token' => $args,
|
||||
])->addMessages([
|
||||
]);
|
||||
|
||||
|
@ -100,7 +100,7 @@ class Config extends Profile
|
|||
|
||||
$this->c->users->update($this->curUser);
|
||||
|
||||
return $this->c->Redirect->page('EditUserBoardConfig', ['id' => $this->curUser->id])->message('Board configuration redirect');
|
||||
return $this->c->Redirect->page('EditUserBoardConfig', $args)->message('Board configuration redirect');
|
||||
}
|
||||
|
||||
$this->fIswev = $v->getErrors();
|
||||
|
@ -108,16 +108,11 @@ class Config extends Profile
|
|||
|
||||
$this->crumbs = $this->crumbs(
|
||||
[
|
||||
$this->c->Router->link(
|
||||
'EditUserBoardConfig',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
$this->c->Router->link('EditUserBoardConfig', $args),
|
||||
__('Board configuration'),
|
||||
]
|
||||
);
|
||||
$this->form = $this->form();
|
||||
$this->form = $this->form($args);
|
||||
$this->actionBtns = $this->btns('config');
|
||||
|
||||
return $this;
|
||||
|
@ -134,22 +129,12 @@ class Config extends Profile
|
|||
/**
|
||||
* Создает массив данных для формы
|
||||
*/
|
||||
protected function form(): array
|
||||
protected function form(array $args): array
|
||||
{
|
||||
$form = [
|
||||
'action' => $this->c->Router->link(
|
||||
'EditUserBoardConfig',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'action' => $this->c->Router->link('EditUserBoardConfig', $args),
|
||||
'hidden' => [
|
||||
'token' => $this->c->Csrf->create(
|
||||
'EditUserBoardConfig',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'token' => $this->c->Csrf->create('EditUserBoardConfig', $args),
|
||||
],
|
||||
'sets' => [],
|
||||
'btns' => [
|
||||
|
|
|
@ -110,7 +110,7 @@ class Edit extends Profile
|
|||
'url' => 'Website',
|
||||
'signature' => 'Signature',
|
||||
])->addArguments([
|
||||
'token' => ['id' => $this->curUser->id],
|
||||
'token' => $args,
|
||||
'username.username' => $this->curUser,
|
||||
])->addMessages([
|
||||
]);
|
||||
|
@ -145,7 +145,7 @@ class Edit extends Profile
|
|||
|
||||
$this->c->users->update($this->curUser);
|
||||
|
||||
return $this->c->Redirect->page('EditUserProfile', ['id' => $this->curUser->id])->message('Profile redirect');
|
||||
return $this->c->Redirect->page('EditUserProfile', $args)->message('Profile redirect');
|
||||
} else {
|
||||
$this->fIswev = $v->getErrors();
|
||||
|
||||
|
@ -155,16 +155,11 @@ class Edit extends Profile
|
|||
|
||||
$this->crumbs = $this->crumbs(
|
||||
[
|
||||
$this->c->Router->link(
|
||||
'EditUserProfile',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
$this->c->Router->link('EditUserProfile', $args),
|
||||
__('Editing profile'),
|
||||
]
|
||||
);
|
||||
$this->form = $this->form();
|
||||
$this->form = $this->form($args);
|
||||
$this->actionBtns = $this->btns('edit');
|
||||
|
||||
return $this;
|
||||
|
@ -218,22 +213,12 @@ class Edit extends Profile
|
|||
/**
|
||||
* Создает массив данных для формы
|
||||
*/
|
||||
protected function form(): array
|
||||
protected function form(array $args): array
|
||||
{
|
||||
$form = [
|
||||
'action' => $this->c->Router->link(
|
||||
'EditUserProfile',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'action' => $this->c->Router->link('EditUserProfile', $args),
|
||||
'hidden' => [
|
||||
'token' => $this->c->Csrf->create(
|
||||
'EditUserProfile',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'token' => $this->c->Csrf->create('EditUserProfile', $args),
|
||||
],
|
||||
'sets' => [],
|
||||
'btns' => [
|
||||
|
@ -285,12 +270,7 @@ class Edit extends Profile
|
|||
'type' => 'link',
|
||||
'value' => __('Configure moderator rights'),
|
||||
'title' => __('Configure moderator rights'),
|
||||
'href' => $this->c->Router->link(
|
||||
'EditUserModeration',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'href' => $this->c->Router->link('EditUserModeration', $args),
|
||||
];
|
||||
}
|
||||
if ($this->rules->setTitle) {
|
||||
|
@ -313,12 +293,7 @@ class Edit extends Profile
|
|||
$fields['change_pass'] = [
|
||||
'type' => 'link',
|
||||
'value' => __('Change passphrase'),
|
||||
'href' => $this->c->Router->link(
|
||||
'EditUserPass',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'href' => $this->c->Router->link('EditUserPass', $args),
|
||||
];
|
||||
}
|
||||
if ($this->rules->useAvatar) {
|
||||
|
@ -429,12 +404,7 @@ class Edit extends Profile
|
|||
$fields['change_email'] = [
|
||||
'type' => 'link',
|
||||
'value' => __($this->rules->confirmEmail ? 'To confirm/change email' : 'To change email'),
|
||||
'href' => $this->c->Router->link(
|
||||
'EditUserEmail',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'href' => $this->c->Router->link('EditUserEmail', $args),
|
||||
];
|
||||
}
|
||||
$fields['email_setting'] = [
|
||||
|
|
|
@ -75,7 +75,7 @@ class Email extends Profile
|
|||
'new_email' => 'New email',
|
||||
'password' => 'Your passphrase',
|
||||
])->addArguments([
|
||||
'token' => ['id' => $this->curUser->id],
|
||||
'token' => $args,
|
||||
'new_email.email' => $this->curUser,
|
||||
])->addMessages([
|
||||
]);
|
||||
|
@ -86,7 +86,7 @@ class Email extends Profile
|
|||
&& ! $this->rules->confirmEmail
|
||||
) {
|
||||
return $this->c->Redirect
|
||||
->page('EditUserProfile', ['id' => $this->curUser->id])
|
||||
->page('EditUserProfile', $args)
|
||||
->message('Email is old redirect');
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class Email extends Profile
|
|||
$this->c->users->update($this->curUser);
|
||||
|
||||
return $this->c->Redirect
|
||||
->page('EditUserProfile', ['id' => $this->curUser->id])
|
||||
->page('EditUserProfile', $args)
|
||||
->message('Email changed redirect');
|
||||
} else {
|
||||
$key = $this->c->Secury->randomPass(33);
|
||||
|
@ -160,25 +160,15 @@ class Email extends Profile
|
|||
|
||||
$this->crumbs = $this->crumbs(
|
||||
[
|
||||
$this->c->Router->link(
|
||||
'EditUserEmail',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
$this->c->Router->link('EditUserEmail', $args),
|
||||
__('Change email'),
|
||||
],
|
||||
[
|
||||
$this->c->Router->link(
|
||||
'EditUserProfile',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
$this->c->Router->link('EditUserProfile', $args),
|
||||
__('Editing profile'),
|
||||
]
|
||||
);
|
||||
$this->form = $this->form();
|
||||
$this->form = $this->form($args);
|
||||
$this->actionBtns = $this->btns('edit');
|
||||
|
||||
return $this;
|
||||
|
@ -187,22 +177,12 @@ class Email extends Profile
|
|||
/**
|
||||
* Создает массив данных для формы
|
||||
*/
|
||||
protected function form(): array
|
||||
protected function form(array $args): array
|
||||
{
|
||||
$form = [
|
||||
'action' => $this->c->Router->link(
|
||||
'EditUserEmail',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'action' => $this->c->Router->link('EditUserEmail', $args),
|
||||
'hidden' => [
|
||||
'token' => $this->c->Csrf->create(
|
||||
'EditUserEmail',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'token' => $this->c->Csrf->create('EditUserEmail', $args),
|
||||
],
|
||||
'sets' => [
|
||||
'new-email' => [
|
||||
|
|
|
@ -43,7 +43,7 @@ class Mod extends Profile
|
|||
'save' => 'required|string',
|
||||
])->addAliases([
|
||||
])->addArguments([
|
||||
'token' => ['id' => $this->curUser->id],
|
||||
'token' => $args,
|
||||
])->addMessages([
|
||||
]);
|
||||
|
||||
|
@ -62,7 +62,7 @@ class Mod extends Profile
|
|||
|
||||
$this->c->forums->reset();
|
||||
|
||||
return $this->c->Redirect->page('EditUserModeration', ['id' => $this->curUser->id])->message('Update rights redirect');
|
||||
return $this->c->Redirect->page('EditUserModeration', $args)->message('Update rights redirect');
|
||||
}
|
||||
|
||||
$this->fIswev = $v->getErrors();
|
||||
|
@ -70,25 +70,15 @@ class Mod extends Profile
|
|||
|
||||
$this->crumbs = $this->crumbs(
|
||||
[
|
||||
$this->c->Router->link(
|
||||
'EditUserModeration',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
$this->c->Router->link('EditUserModeration', $args),
|
||||
__('Moderator rights'),
|
||||
],
|
||||
[
|
||||
$this->c->Router->link(
|
||||
'EditUserProfile',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
$this->c->Router->link('EditUserProfile', $args),
|
||||
__('Editing profile'),
|
||||
]
|
||||
);
|
||||
$this->form = $this->form();
|
||||
$this->form = $this->form($args);
|
||||
$this->actionBtns = $this->btns('edit');
|
||||
|
||||
return $this;
|
||||
|
@ -107,22 +97,12 @@ class Mod extends Profile
|
|||
/**
|
||||
* Создает массив данных для формы
|
||||
*/
|
||||
protected function form(): array
|
||||
protected function form(array $args): array
|
||||
{
|
||||
$form = [
|
||||
'action' => $this->c->Router->link(
|
||||
'EditUserModeration',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'action' => $this->c->Router->link('EditUserModeration', $args),
|
||||
'hidden' => [
|
||||
'token' => $this->c->Csrf->create(
|
||||
'EditUserModeration',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'token' => $this->c->Csrf->create('EditUserModeration', $args),
|
||||
],
|
||||
'sets' => [],
|
||||
'btns' => [
|
||||
|
|
|
@ -47,13 +47,13 @@ class Pass extends Profile
|
|||
'new_pass' => 'New pass',
|
||||
'password' => 'Your passphrase',
|
||||
])->addArguments([
|
||||
'token' => ['id' => $this->curUser->id],
|
||||
'token' => $args,
|
||||
])->addMessages([
|
||||
]);
|
||||
|
||||
if ($v->validation($_POST)) {
|
||||
// if (\password_verify($v->new_pass, $this->curUser->password)) {
|
||||
// return $this->c->Redirect->page('EditUserProfile', ['id' => $this->curUser->id])->message('Email is old redirect');
|
||||
// return $this->c->Redirect->page('EditUserProfile', $args)->message('Email is old redirect');
|
||||
// }
|
||||
|
||||
$this->curUser->password = \password_hash($v->new_pass, \PASSWORD_DEFAULT);
|
||||
|
@ -65,7 +65,7 @@ class Pass extends Profile
|
|||
# return $auth->login([], 'GET', $this->curUser->username);
|
||||
return $this->c->Redirect->page('Login')->message('Pass updated'); // ???? нужна передача данных между скриптами не привязанная к пользователю
|
||||
} else {
|
||||
return $this->c->Redirect->page('EditUserProfile', ['id' => $this->curUser->id])->message('Pass updated redirect');
|
||||
return $this->c->Redirect->page('EditUserProfile', $args)->message('Pass updated redirect');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,25 +74,15 @@ class Pass extends Profile
|
|||
|
||||
$this->crumbs = $this->crumbs(
|
||||
[
|
||||
$this->c->Router->link(
|
||||
'EditUserPass',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
$this->c->Router->link('EditUserPass', $args),
|
||||
__('Change pass'),
|
||||
],
|
||||
[
|
||||
$this->c->Router->link(
|
||||
'EditUserProfile',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
$this->c->Router->link('EditUserProfile', $args),
|
||||
__('Editing profile'),
|
||||
]
|
||||
);
|
||||
$this->form = $this->form();
|
||||
$this->form = $this->form($args);
|
||||
$this->actionBtns = $this->btns('edit');
|
||||
|
||||
return $this;
|
||||
|
@ -101,22 +91,12 @@ class Pass extends Profile
|
|||
/**
|
||||
* Создает массив данных для формы
|
||||
*/
|
||||
protected function form(): array
|
||||
protected function form(array $args): array
|
||||
{
|
||||
$form = [
|
||||
'action' => $this->c->Router->link(
|
||||
'EditUserPass',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'action' => $this->c->Router->link('EditUserPass', $args),
|
||||
'hidden' => [
|
||||
'token' => $this->c->Csrf->create(
|
||||
'EditUserPass',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'token' => $this->c->Csrf->create('EditUserPass', $args),
|
||||
],
|
||||
'sets' => [
|
||||
'new-pass' => [
|
||||
|
|
|
@ -158,12 +158,7 @@ class View extends Profile
|
|||
'type' => 'link',
|
||||
'caption' => __('Email info'),
|
||||
'value' => __('Send email'),
|
||||
'href' => $this->c->Router->link(
|
||||
'SendEmail',
|
||||
[
|
||||
'id' => $this->curUser->id,
|
||||
]
|
||||
),
|
||||
'href' => $this->c->Router->link('SendEmail', $args),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue