I wrote an authentication class controller containing a method for checking the user's login status and redirecting it to the login page if he / she is not logged in.
I need to call this function from other controller methods to authenticate the user. What is a good way to do this?
Extract this method from this controller.
Assuming you have a User model, this is a great place to host it if it authenticates the user and logs him in.
, , ( ) ().
.
, .
, user_model .
, . , , , parent::_check_login(), , , .
parent::_check_login()
sumanchalki , , .
CodeIgniter: DRY
This will show you how to create named base controllers, such as an administrator controller, which can contain user authentication logic and more.
Source: https://habr.com/ru/post/1719729/More articles:Могу ли я получить данные IPTC и EXIF с изображения с помощью imageMagick? - linuxcss layout: поля и отступы по сравнению с абсолютным позиционированием? - cssМожно ли связать несколько скомпилированных запросов linq вместе? - linqHow can I paste in Yahoo! Channel name? - regexA smart way to estimate clicks on clicks per hour without registering every click? - urlHow to remove OutputCache programmatically for ascx? - asp.netfilter_var vs preg_match - phpstatic method with polymorphism in C ++ - c ++Delphi: How to have an non-contiguous enumeration type of subbands? - enumsWhat is "dwarf2_read_address: corrupted DWARF expression". I mean? - iphoneAll Articles