authmotion

Installation

Add this line to your application's Gemfile:

gem 'authmotion'

And then execute:

$ bundle

Or install it yourself as:

$ gem install authmotion

How use it for login?

class LoginController < UIViewController
  include Auth::EmailLogin

  def viewDidLoad
     #anything here... should be your form
  end

  ## You need define how get this fields, in this example i guess that the
  ## inputs should be @email and @password  
  def user_field
    @email 
  end

  def password_field
    @password
  end

  #  format data for send to server
  def 
    {user:{login: @email.text, password:@password.text}}
  end

  # URL connection for login
  def 
    "http://auth-motion-server.herokuapp.com/users/login"
  end

  #  Wating actions. In this app you'll see a background and an animation
  def waiting_view
    @background = WaitingView.create
    view.addSubview(@background)
  end

  def hide_waiting_view
    @background.removeFromSuperview
  end

  def 
    lambda{ |response| "PUTS YOUR ACTIONS HERE" }
  end
end

case test

  • login, password: 123456

How use it for Register?

class LoginController < UIViewController
  include Auth::EmailLogin

  def viewDidLoad
     #anything here... should be your form
  end

  ## You need define how get this fields,
  ## in this example i guess that the inputs should be @email, @password,@password_confirmation  
  def user_field
    @email 
  end

  def password_field
    @password
  end

  def password_confirmation_field
    @password_confirmation
  end

  #########
  #  format data for send to server

  def 
    {user:{login: @email.text, password:@password.text, password_confirmation: @password_confirmation.text}}
  end

  # URL connection for register, POST

  def 
    "http://auth-motion-server.herokuapp.com/users"
  end

  #  Wating actions. In this app you'll see a background and an animation
  def waiting_view
    @background = WaitingView.create
    view.addSubview(@background)
  end

  def hide_waiting_view
    @background.removeFromSuperview
  end

  def success_conection_register
    lambda{ |response| "PUTS YOUR ACTIONS HERE" }
  end
end

case test

  • Can register => login, password: 123456, password_password: 123456
  • Is registered => registered, password: ..., password: ... any password it's ok
  • Other error, you can test with any user.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request