Jump to content
Sign in to follow this  
Fedayn

Login controller..

Recommended Posts

class [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27LoginController%27%29"]LoginController[/url] < [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27ApplicationController%27%29"]ApplicationController[/url]

 def [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27index%27%29"]index[/url]
   if @[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27params%27%29"]params[/url]['user']
     if [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27user%27%29"]user[/url] = [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27User%27%29"]User[/url].[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27authenticate%27%29"]authenticate[/url](@[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27params%27%29"]params[/url]['user']['login'], @[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27params%27%29"]params[/url]['user']['password'])
       @[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27session%27%29"]session[/url]['user'] = [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27user%27%29"]user[/url]
       if @[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27session%27%29"]session[/url]['return_to']
         [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27redirect_to_path%27%29"]redirect_to_path[/url](@[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27session%27%29"]session[/url]['return_to'])
         @[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27session%27%29"]session[/url]['return_to'] = nil
       else
         [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27redirect_to%27%29"]redirect_to[/url] :[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27controller%27%29"]controller[/url] => 'admin'
       end
     end
     [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27setNotice%27%29"]setNotice[/url] "Assicurati di aver inserito dei dati corretti."
   end
 end

 def [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27out%27%29"]out[/url]
   @[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27session%27%29"]session[/url]['user'] = nil
   [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27redirect_to%27%29"]redirect_to[/url] :[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27controller%27%29"]controller[/url] => 'admin'
 end

[url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27protected%27%29"]protected[/url]

 def [url="http://javascript%3Cb%3E%3C/b%3E:searchRef%28%27secure%27%29"]secure[/url]?
    false
 end

end

allora, il linguaggio è ruby on rails e ho realizzato una piccola piattaforma che mi permetta di gestire i dipendenti dell'azienda per cui lavoro. Avrei potuto benissimo farlo in PHP o altro ma è stata anche un occasino per fare una piccola sfida con me stesso.. il punto è:

 

una volta inserito l'ID Card del dipendente è la password assegnata, perchè non fa il login all'area privata di ogni dipendente dove sono contenuti i dati dei clienti e tutte le info??? Non funziona:bua:

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×