Screencast - restful_authentication
restful_authentication - Screencast (pt-br) from Marcio Garcia on Vimeo.
Instalação do restful_authentication
URL do plugin:http://svn.techno-weenie.net/projects/plugins/restful_authentication/
./scrpt/plugin source http://svn.techno-weenie.net/projects/plugins/restful_authentication/ ./script/plugin install restful_authentication
Criação dos controllers e model padrão
./script/generate authenticated user sessions
Alterações de código
routes.rb#novas rotas.... map.signup '/', :controller => 'sessions', :action => 'new' map.signup '/signup', :controller => 'users', :action => 'new' map.login '/login', :controller => 'sessions', :action => 'new' map.logout '/logout', :controller => 'sessions', :action => 'destroy'
app/views/layouts/application.html.erb
<html> <head> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <%= stylesheet_link_tag 'scaffold' %> </head> <body bgcolor="#1471B7"> <center> <p> </p> <table width="90%" bgcolor="#FFFFFF"> <tr> <td align="center"> <%= yield%> </td> </tr> </table> </center> </body> </html>
app/controllers/application.rb
include AuthenticatedSystem
app/controllers/sessions_controller.rb
def new #alterado.................... flash[:notice] = "Usuario logado!" if logged_in? flash[:notice] = "Usuario NÃO logado!" unless logged_in? end
app/controllers/users_controller.rb
#alterado...................... before_filter :authentication def authentication redirect_back_or_default('/') unless logged_in? end
http://github.com/dcrec1/restful-authentication-i18n/tree/master
Diego Carrion
7 Nov 08 at 4:37 pm
Junio Vitorino
8 Nov 08 at 9:12 pm
restful_authentication - autenticação com terceira chave at Marcio Garcia
10 Nov 08 at 9:23 pm