Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [Kohana]Problem z Auth
S_Olewniczak
post
Post #1





Grupa: Zarejestrowani
Postów: 189
Pomógł: 1
Dołączył: 28.01.2008

Ostrzeżenie: (0%)
-----


Mam następujący kod:
  1. class User_Controller extends Controller {
  2. public function login() {
  3. $form = new View('login');
  4. $form->error = false;
  5. $form->username ='';
  6. if($_POST) {
  7. $this->auth = new Auth();
  8. $username=$this->input->post('username');
  9. $user = ORM :: factory('user', $username);
  10.  
  11. if ($this->auth->login($user, $this->input->post('password'))){
  12. url::redirect($this->session->get_once('requested_url'));
  13. } else {
  14. $form->error = true;
  15. $form->username = $username;
  16. }
  17. }//end if
  18. $header = new View('header');
  19. $header->subtitle = Kohana::lang('main.login');
  20. $header->render(true);
  21.  
  22.  
  23. $form->render(true);
  24. }//end func

Jednak nie mogę się zalogować. Co robię źle? Jeżeli z tego kodu nic nie wynika, to jakie inne fragmenty mam go podać?
Go to the top of the page
+Quote Post
bełdzio
post
Post #2





Grupa: Zarejestrowani
Postów: 690
Pomógł: 81
Dołączył: 6.04.2005
Skąd: Szczecin

Ostrzeżenie: (0%)
-----


dodałeś użytkownikowi rolę "login" ?
Go to the top of the page
+Quote Post
S_Olewniczak
post
Post #3





Grupa: Zarejestrowani
Postów: 189
Pomógł: 1
Dołączył: 28.01.2008

Ostrzeżenie: (0%)
-----


Zdaje mi się, że tak, ale mogłem coś pomieszać. Jakim zapytaniem SQL można tego dokonać? Przypuśćmy, że użytkownik ma id 1.
Go to the top of the page
+Quote Post
skowron-line
post
Post #4





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

Ostrzeżenie: (0%)
-----


@S_Olewniczak włącz profilera i zobacz jakie zapytania latają do bazy.
Go to the top of the page
+Quote Post
S_Olewniczak
post
Post #5





Grupa: Zarejestrowani
Postów: 189
Pomógł: 1
Dołączył: 28.01.2008

Ostrzeżenie: (0%)
-----


Zdaje mis się, że żadne (IMG:style_emoticons/default/haha.gif) . Oto rezultat:

Benchmarks Time Count Memory
Kohana Loading 0.011 1 0.44MB
Environment Setup 0.002 1 0.05MB
System Initialization 0.004 1 0.14MB
Controller Setup 0.006 1 0.14MB
Controller Execution 0.185 1 1.43MB
Total Execution 0.207 1 2.14MB
Queries Time Rows
Total: 0 0.000 0


Session Value
session_id ...
total_hits 2
_kf_flash_

Array
(
)

user_agent Mozilla/5.0 (X11; U; Linux i686; pl-PL; rv:1.9.0.13) Gecko/2009080315 Ubuntu/9.04 (jaunty) Firefox/3.0.13
ip_address 127.0.0.1
last_activity 1251726420

POST Value
username szymon
password test

Cookies Value
kohanasession ...
kohanasession_data ...
Go to the top of the page
+Quote Post
skowron-line
post
Post #6





Grupa: Zarejestrowani
Postów: 4 340
Pomógł: 542
Dołączył: 15.01.2006
Skąd: Olsztyn/Warszawa

Ostrzeżenie: (0%)
-----


(IMG:style_emoticons/default/smile.gif) dobre.

Zainteresuj się simpleAuth

http://thejw23.blogspot.com/2009/04/simple...rowadzenie.html
http://thejw23.blogspot.com/2009/04/simple...-przyklady.html

łatwe i przyjemne. Generalnie cały blog tego kolesia jest godny uwagi jak również kolegi @bełdzio
Go to the top of the page
+Quote Post
S_Olewniczak
post
Post #7





Grupa: Zarejestrowani
Postów: 189
Pomógł: 1
Dołączył: 28.01.2008

Ostrzeżenie: (0%)
-----


Simple Auth też mi nie działa (IMG:style_emoticons/default/sadsmiley02.gif) . Może problem tkwi gdzieś głębiej?
Go to the top of the page
+Quote Post
thek
post
Post #8





Grupa: Moderatorzy
Postów: 4 362
Pomógł: 714
Dołączył: 12.02.2009
Skąd: Jak się położę tak leżę :D




Wyświetl Kohana::debug() to powinno Ci wszystko co sie da wyświetlić, włacznie z obiektami, ostatnimi zapytaniami itp. Może tam coś ciekawego znajdziesz. Ja używam simpleAuth i na razie nie miałem problemów z nim.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 14:26