themes add and some fix

This commit is contained in:
2025-01-19 20:50:25 +03:00
parent 219ca30608
commit a943b960ad
200 changed files with 796 additions and 106 deletions

24
kernel/modules/user/service/UserService.php Normal file → Executable file
View File

@ -15,6 +15,7 @@ class UserService
$model->username = $form_model->getItem('username');
$model->email = $form_model->getItem('email');
$model->password_hash = password_hash($form_model->getItem('password'), PASSWORD_DEFAULT);
$model->user_photo = $form_model->getItem('user_photo');
if ($model->save()){
return $model;
}
@ -29,6 +30,7 @@ class UserService
if ($form_model->getItem('password')) {
$user->password_hash = password_hash($form_model->getItem('password'), PASSWORD_DEFAULT);
}
$user->user_photo = $form_model->getItem('user_photo');
if ($user->save()){
return $user;
}
@ -80,6 +82,28 @@ class UserService
return '';
}
public static function getAuthUserId(): string
{
$user = self::getAuthUser();
if ($user){
return $user->id;
}
return '';
}
public static function getAuthUserPhoto(): string|null
{
$user = self::getAuthUser();
if ($user){
if ($user->user_photo) {
return $user->user_photo;
}
}
return null;
}
public function getByAccessToken(string $token)
{
return $this->getByField("access_token", $token);