vendredi 31 juillet 2015

Trying to create log in form with Parse in Rails

so im trying to create a login form for Parse in rails using gem parse-ruby-client and this is what i got so far, i know i have some routing issue i need help with.

heres what i got:

login_controller.rb:

class LoginController < ApplicationController
  def index
    user = Parse::User.authenticate(params[:user][:username],params[:user][:password] )
  end
end

index.html.erb:

<% @page_title = "Log in" %>
<div class="Log_in_Form">
  <h4><center>Log in with your existing "app_name" account</center></h4>
  <%= form_for(:user, :url => {:controller => 'login', :action => 'index'}) do |f| %>
    <center><p> Username:</br> <%= f.text_field :username%> </p></center>
    <center><p> Password:</br> <%= f.password_field :password%></p></center>
    <center><h4><%= f.submit :Login %></h4></center>
  <% end %>
</div>

routes.rb

Rails.application.routes.draw do
  get 'welcome/index'

  root 'login#index'

end

basically i want to be able to input username and password and be directed to the next view being logged in successfully.

Aucun commentaire:

Enregistrer un commentaire