Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- match '/usersregister', :to => "users#register", :as => "usersregister"
- match '/usersregister/:email', :to => "users#register", :as => "usersregister"
- match '/userscreate', :to => "users#create", :via => :post
- #get "users/login"
- match '/userslogin', :to => "users#login", :as => "userslogin"
- match '/userslogin/:email', :to => "users#login", :as => "userslogin"
- match '/usersverify', :to => "users#verify", :via => :post
- --------------------------------------------
- it "should redirect to register page if email not found" do
- post :verify, :user => {:email => "somearbitemail@gmail.com", :password => "some password"}
- #response.should redirect_to(usersregister_path(:email => "somearbitemail@gmail.com"))
- response.should redirect_to :action => 'register', :email => "somearbitemail@gmail.com"
- #to-do put condition to check if email is populated with the given email
- end
- -------------------------------------------------
- def verify
- @user = User.find_by_email(params[:user][:email])
- if @user.nil?
- #redirect_to usersregister_path(:email => params[:user][:email])
- redirect_to :action => "register", :email => params[:user][:email]
- else
- if @user.password != params[:user][:password]
- redirect_to :action => "register", :email => params[:user][:email]
- #redirect_to userslogin_path(:email => @user.email)
- else
- session[:token] = @user.email
- render 'accounts/list'
- end
- end
- end
Add Comment
Please, Sign In to add comment