user_authentication 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66bc3426a5ae74be5cac2e2469cddace55db69da
4
- data.tar.gz: f78a03660b62ea4eb14ca4fe7481004fe4d18885
3
+ metadata.gz: 9edc3c4e587dcc8f8ef35fe076ab510ea8247712
4
+ data.tar.gz: 5371d096bd944a07c75dcfbf2aaa259f81498b11
5
5
  SHA512:
6
- metadata.gz: 20e69008688ba3b3828e3cb07c03a6b62843d7c31b0ff7f5ce8c2e976502288a5af2d7655a81bf389dc701aee3d6e35708bc3d7ac7a142216445c872c3aa0580
7
- data.tar.gz: 4178aaa68dba5325d7b63c5dd1c28420a0d256c946d6831b7cb39b66b43e5593587f2228d8ecccf774f3b023d9df82ad1cd3dd18bd0f16f956b376fb94aba483
6
+ metadata.gz: 7e877ab311c3de528bacedca13710fea050e88366636670c63b5602f41ab5b31593542df262d093d5f42ce49d041d56a103e73aed0b6d2decc31228fedc834a3
7
+ data.tar.gz: a093222d975932e8df5feb8781a2ea22ac87c83923a02d7671bef997662171cb3384beaa3a5cc6925f560225dd14307967fb7f3efe8390cd5a5b9888530655d7
@@ -1,11 +1,9 @@
1
1
  class AccountsController < ApplicationController
2
- before_filter :authorize, only: [:set_password]
2
+ before_filter :authorize, only: [:do_set_password]
3
3
 
4
4
  def login
5
5
  end
6
6
 
7
- def signup
8
- end
9
7
 
10
8
  def do_login
11
9
  account = Account.find_by_email params[:email]
@@ -23,7 +21,8 @@ class AccountsController < ApplicationController
23
21
  end
24
22
  end
25
23
 
26
- def do_logout
24
+
25
+ def logout
27
26
  session.delete :account_id
28
27
  set_current_account
29
28
 
@@ -34,6 +33,11 @@ class AccountsController < ApplicationController
34
33
  end
35
34
  end
36
35
 
36
+
37
+ def signup
38
+ end
39
+
40
+
37
41
  def do_signup
38
42
  account = Account.new
39
43
  account.email = params[:email]
@@ -56,7 +60,12 @@ class AccountsController < ApplicationController
56
60
  end
57
61
  end
58
62
 
59
- def set_password
63
+
64
+ def do_set_password
65
+ unless params[:password] == params[:password_confirmation]
66
+ return redirect_to :back, alert: 'Passwords do not match.'
67
+ end
68
+
60
69
  current_account.password = params[:password]
61
70
  current_account.save
62
71
 
data/config/routes.rb CHANGED
@@ -1,11 +1,8 @@
1
1
  Rails.application.routes.draw do
2
- match "login" => "accounts#login", :via => :get
3
- match "login" => "accounts#do_login", :via => :post
4
-
5
- match "logout" => "accounts#do_logout", :via => :get
6
-
7
- match "signup" => "accounts#signup", :via => :get
8
- match "signup" => "accounts#do_signup", :via => :post
9
-
10
- match "set_password" => "accounts#set_password", :via => :post
2
+ get 'login' => 'accounts#login'
3
+ post 'login' => 'accounts#do_login'
4
+ get 'logout' => 'accounts#logout'
5
+ post 'set_password' => 'accounts#do_set_password'
6
+ get 'signup' => 'accounts#signup'
7
+ post 'signup' => 'accounts#do_signup'
11
8
  end
@@ -1,3 +1,3 @@
1
1
  module UserAuthentication
2
- VERSION = '1.1.0'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: user_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sujoy Gupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-21 00:00:00.000000000 Z
11
+ date: 2015-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -149,7 +149,6 @@ files:
149
149
  - app/controllers/application_controller.rb
150
150
  - app/helpers/application_helper.rb
151
151
  - app/models/account.rb
152
- - app/models/account.rb~
153
152
  - app/validators/email_validator.rb
154
153
  - app/views/accounts/login.html.erb
155
154
  - app/views/accounts/signup.html.erb
@@ -160,9 +159,7 @@ files:
160
159
  - lib/random.rb
161
160
  - lib/tasks/user_authentication_tasks.rake
162
161
  - lib/user_authentication.rb
163
- - lib/user_authentication.rb~
164
162
  - lib/user_authentication/version.rb
165
- - lib/user_authentication/version.rb~
166
163
  homepage: http://github.com/sujoyg/user_authentication
167
164
  licenses:
168
165
  - MIT
@@ -1,11 +0,0 @@
1
- require File.expand_path('../../../lib/random', __FILE__)
2
-
3
- class Account < ActiveRecord::Base
4
- has_secure_password
5
-
6
- before_validation { |account| account.password = Random.password if account.password.nil? }
7
- validates :email, presence: true, uniqueness: true, email: true
8
- end
9
-
10
- app_model = File.join Rails.root, 'app/models/account.rb'
11
- require app_model if File.exists? app_model
@@ -1,16 +0,0 @@
1
- module UserAuthentication
2
- class Engine < Rails::Engine
3
- engine_name 'user_authentication'
4
-
5
- initializer 'user_authentication_engine.app_controller' do |app|
6
- ActiveSupport.on_load(:action_controller) do
7
- require File.expand_path('../../app/controllers/application_controller', __FILE__)
8
- require File.expand_path('../../app/helpers/application_helper', __FILE__)
9
- end
10
- end
11
-
12
- config.after_initialize do
13
- require File.expand_path('../../app/models/account', __FILE__)
14
- end
15
- end
16
- end
@@ -1,3 +0,0 @@
1
- module UserAuthentication
2
- VERSION = '1.0.0'
3
- end