Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.bundle
app
lib
resources
spec
.gitignore
.rvmrc
Gemfile
Gemfile.lock
README.md
Rakefile
authmotion.gemspec

README.md

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 data_login_user
    {user:{login: @email.text, password:@password.text}}
  end

  # URL connection for login
  def url_log_in
    "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 success_conection_login
    lambda{ |response| "PUTS YOUR ACTIONS HERE" }
  end
end

case test

  • {user: 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 data_login_user
    {user:{login: @email.text, password:@password.text, password_confirmation: @password_confirmation.text}}
  end

  # URL connection for register, POST

  def url_log_in
    "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 => {user: login, password: 123456, password_password: 123456}
  • Is registered => {user: 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
Something went wrong with that request. Please try again.