tonkapark-clearance 0.6.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.textile +167 -0
- data/LICENSE +21 -0
- data/README.textile +123 -0
- data/Rakefile +76 -0
- data/TODO.textile +6 -0
- data/app/controllers/clearance/confirmations_controller.rb +52 -0
- data/app/controllers/clearance/passwords_controller.rb +81 -0
- data/app/controllers/clearance/sessions_controller.rb +67 -0
- data/app/controllers/clearance/users_controller.rb +35 -0
- data/app/models/clearance_mailer.rb +23 -0
- data/app/views/clearance_mailer/change_password.html.erb +7 -0
- data/app/views/clearance_mailer/confirmation.html.erb +2 -0
- data/app/views/passwords/edit.html.erb +23 -0
- data/app/views/passwords/new.html.erb +15 -0
- data/app/views/sessions/new.html.erb +28 -0
- data/app/views/users/_form.html.erb +13 -0
- data/app/views/users/new.html.erb +6 -0
- data/clearance.gemspec +140 -0
- data/config/clearance_routes.rb +30 -0
- data/generators/clearance/USAGE +1 -0
- data/generators/clearance/clearance_generator.rb +41 -0
- data/generators/clearance/lib/insert_commands.rb +33 -0
- data/generators/clearance/lib/rake_commands.rb +22 -0
- data/generators/clearance/templates/README +22 -0
- data/generators/clearance/templates/factories.rb +13 -0
- data/generators/clearance/templates/migrations/create_users.rb +21 -0
- data/generators/clearance/templates/migrations/update_users.rb +41 -0
- data/generators/clearance/templates/user.rb +3 -0
- data/generators/clearance_features/USAGE +1 -0
- data/generators/clearance_features/clearance_features_generator.rb +20 -0
- data/generators/clearance_features/templates/features/password_reset.feature +33 -0
- data/generators/clearance_features/templates/features/sign_in.feature +42 -0
- data/generators/clearance_features/templates/features/sign_out.feature +23 -0
- data/generators/clearance_features/templates/features/sign_up.feature +28 -0
- data/generators/clearance_features/templates/features/step_definitions/clearance_steps.rb +110 -0
- data/generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb +5 -0
- data/generators/clearance_features/templates/features/support/paths.rb +22 -0
- data/lib/clearance/authentication.rb +100 -0
- data/lib/clearance/extensions/errors.rb +6 -0
- data/lib/clearance/extensions/rescue.rb +3 -0
- data/lib/clearance/extensions/routes.rb +14 -0
- data/lib/clearance/user.rb +143 -0
- data/lib/clearance.rb +6 -0
- data/rails/init.rb +1 -0
- data/shoulda_macros/clearance.rb +262 -0
- metadata +138 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
<h2>Change your password</h2>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
Your password has been reset. Choose a new password below.
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<%= error_messages_for :user %>
|
8
|
+
|
9
|
+
<% form_for(:user,
|
10
|
+
:url => user_password_path(@user, :token => @user.token),
|
11
|
+
:html => { :method => :put }) do |form| %>
|
12
|
+
<div class="password_field">
|
13
|
+
<%= form.label :password, "Choose password" %>
|
14
|
+
<%= form.password_field :password %>
|
15
|
+
</div>
|
16
|
+
<div class="password_field">
|
17
|
+
<%= form.label :password_confirmation, "Confirm password" %>
|
18
|
+
<%= form.password_field :password_confirmation %>
|
19
|
+
</div>
|
20
|
+
<div class="submit_field">
|
21
|
+
<%= form.submit "Save this password", :disable_with => "Please wait..." %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<h2>Change your password</h2>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
We will email you a link to change your password.
|
5
|
+
</p>
|
6
|
+
|
7
|
+
<% form_for :password, :url => passwords_path do |form| %>
|
8
|
+
<div class="text_field">
|
9
|
+
<%= form.label :email, "Email address" %>
|
10
|
+
<%= form.text_field :email %>
|
11
|
+
</div>
|
12
|
+
<div class="submit_field">
|
13
|
+
<%= form.submit "Reset password", :disable_with => "Please wait..." %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<h2>Sign in</h2>
|
2
|
+
|
3
|
+
<% form_for :session, :url => session_path do |form| %>
|
4
|
+
<div class="text_field">
|
5
|
+
<%= form.label :email %>
|
6
|
+
<%= form.text_field :email %>
|
7
|
+
</div>
|
8
|
+
<div class="text_field">
|
9
|
+
<%= form.label :password %>
|
10
|
+
<%= form.password_field :password %>
|
11
|
+
</div>
|
12
|
+
<div class="text_field">
|
13
|
+
<%= form.check_box :remember_me %>
|
14
|
+
<%= form.label :remember_me %>
|
15
|
+
</div>
|
16
|
+
<div class="submit_field">
|
17
|
+
<%= form.submit "Sign in", :disable_with => "Please wait..." %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<ul>
|
22
|
+
<li>
|
23
|
+
<%= link_to "Sign up", new_user_path %>
|
24
|
+
</li>
|
25
|
+
<li>
|
26
|
+
<%= link_to "Forgot password?", new_password_path %>
|
27
|
+
</li>
|
28
|
+
</ul>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= form.error_messages %>
|
2
|
+
<div class="text_field">
|
3
|
+
<%= form.label :email %>
|
4
|
+
<%= form.text_field :email %>
|
5
|
+
</div>
|
6
|
+
<div class="password_field">
|
7
|
+
<%= form.label :password %>
|
8
|
+
<%= form.password_field :password %>
|
9
|
+
</div>
|
10
|
+
<div class="password_field">
|
11
|
+
<%= form.label :password_confirmation, "Confirm password" %>
|
12
|
+
<%= form.password_field :password_confirmation %>
|
13
|
+
</div>
|
data/clearance.gemspec
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: clearance
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.9.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Croak
|
8
|
+
- Mike Burns
|
9
|
+
- Jason Morrison
|
10
|
+
- Joe Ferris
|
11
|
+
- Eugene Bolshakov
|
12
|
+
- Nick Quaranto
|
13
|
+
- Josh Nichols
|
14
|
+
- Mike Breen
|
15
|
+
- "Marcel G\xC3\xB6rner"
|
16
|
+
- Bence Nagy
|
17
|
+
- Ben Mabey
|
18
|
+
- Eloy Duran
|
19
|
+
- Tim Pope
|
20
|
+
- Mihai Anca
|
21
|
+
- Mark Cornick
|
22
|
+
- Shay Arnett
|
23
|
+
autorequire:
|
24
|
+
bindir: bin
|
25
|
+
cert_chain: []
|
26
|
+
|
27
|
+
date: 2009-07-16 00:00:00 -05:00
|
28
|
+
default_executable:
|
29
|
+
dependencies: []
|
30
|
+
|
31
|
+
description: Rails authentication with email & password.
|
32
|
+
email: matt@tonkapark.com
|
33
|
+
executables: []
|
34
|
+
|
35
|
+
extensions: []
|
36
|
+
|
37
|
+
extra_rdoc_files: []
|
38
|
+
|
39
|
+
files:
|
40
|
+
- app
|
41
|
+
- CHANGELOG.textile
|
42
|
+
- clearance.gemspec
|
43
|
+
- config
|
44
|
+
- generators
|
45
|
+
- lib
|
46
|
+
- LICENSE
|
47
|
+
- rails
|
48
|
+
- Rakefile
|
49
|
+
- README.textile
|
50
|
+
- shoulda_macros
|
51
|
+
- test
|
52
|
+
- TODO.textile
|
53
|
+
- app/controllers
|
54
|
+
- app/controllers/clearance
|
55
|
+
- app/controllers/clearance/confirmations_controller.rb
|
56
|
+
- app/controllers/clearance/passwords_controller.rb
|
57
|
+
- app/controllers/clearance/sessions_controller.rb
|
58
|
+
- app/controllers/clearance/users_controller.rb
|
59
|
+
- app/models
|
60
|
+
- app/models/clearance_mailer.rb
|
61
|
+
- app/views
|
62
|
+
- app/views/clearance_mailer
|
63
|
+
- app/views/clearance_mailer/change_password.html.erb
|
64
|
+
- app/views/clearance_mailer/confirmation.html.erb
|
65
|
+
- app/views/passwords
|
66
|
+
- app/views/passwords/edit.html.erb
|
67
|
+
- app/views/passwords/new.html.erb
|
68
|
+
- app/views/sessions
|
69
|
+
- app/views/sessions/new.html.erb
|
70
|
+
- app/views/users
|
71
|
+
- app/views/users/new.html.erb
|
72
|
+
- app/views/users/_form.html.erb
|
73
|
+
- config/clearance_routes.rb
|
74
|
+
- generators/clearance
|
75
|
+
- generators/clearance/clearance_generator.rb
|
76
|
+
- generators/clearance/lib
|
77
|
+
- generators/clearance/lib/insert_commands.rb
|
78
|
+
- generators/clearance/lib/rake_commands.rb
|
79
|
+
- generators/clearance/templates
|
80
|
+
- generators/clearance/templates/factories.rb
|
81
|
+
- generators/clearance/templates/migrations
|
82
|
+
- generators/clearance/templates/migrations/create_users.rb
|
83
|
+
- generators/clearance/templates/migrations/update_users.rb
|
84
|
+
- generators/clearance/templates/README
|
85
|
+
- generators/clearance/templates/user.rb
|
86
|
+
- generators/clearance/USAGE
|
87
|
+
- generators/clearance_features
|
88
|
+
- generators/clearance_features/clearance_features_generator.rb
|
89
|
+
- generators/clearance_features/templates
|
90
|
+
- generators/clearance_features/templates/features
|
91
|
+
- generators/clearance_features/templates/features/password_reset.feature
|
92
|
+
- generators/clearance_features/templates/features/sign_in.feature
|
93
|
+
- generators/clearance_features/templates/features/sign_out.feature
|
94
|
+
- generators/clearance_features/templates/features/sign_up.feature
|
95
|
+
- generators/clearance_features/templates/features/step_definitions
|
96
|
+
- generators/clearance_features/templates/features/step_definitions/clearance_steps.rb
|
97
|
+
- generators/clearance_features/templates/features/step_definitions/factory_girl_steps.rb
|
98
|
+
- generators/clearance_features/templates/features/support
|
99
|
+
- generators/clearance_features/templates/features/support/paths.rb
|
100
|
+
- generators/clearance_features/USAGE
|
101
|
+
- lib/clearance
|
102
|
+
- lib/clearance/authentication.rb
|
103
|
+
- lib/clearance/extensions
|
104
|
+
- lib/clearance/extensions/errors.rb
|
105
|
+
- lib/clearance/extensions/rescue.rb
|
106
|
+
- lib/clearance/extensions/routes.rb
|
107
|
+
- lib/clearance/user.rb
|
108
|
+
- lib/clearance.rb
|
109
|
+
- shoulda_macros/clearance.rb
|
110
|
+
- rails/init.rb
|
111
|
+
has_rdoc: true
|
112
|
+
homepage: http://github.com/tonkapark/clearance
|
113
|
+
licenses: []
|
114
|
+
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: "0"
|
125
|
+
version:
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: "0"
|
131
|
+
version:
|
132
|
+
requirements: []
|
133
|
+
|
134
|
+
rubyforge_project:
|
135
|
+
rubygems_version: 1.3.4
|
136
|
+
signing_key:
|
137
|
+
specification_version: 3
|
138
|
+
summary: Rails authentication with email & password.
|
139
|
+
test_files: []
|
140
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
map.resources :passwords,
|
3
|
+
:controller => 'clearance/passwords',
|
4
|
+
:only => [:new, :create]
|
5
|
+
|
6
|
+
map.resource :session,
|
7
|
+
:controller => 'clearance/sessions',
|
8
|
+
:only => [:new, :create, :destroy]
|
9
|
+
|
10
|
+
map.resources :users, :controller => 'clearance/users' do |users|
|
11
|
+
users.resource :password,
|
12
|
+
:controller => 'clearance/passwords',
|
13
|
+
:only => [:create, :edit, :update]
|
14
|
+
|
15
|
+
users.resource :confirmation,
|
16
|
+
:controller => 'clearance/confirmations',
|
17
|
+
:only => [:new, :create]
|
18
|
+
end
|
19
|
+
|
20
|
+
map.sign_up 'sign_up',
|
21
|
+
:controller => 'clearance/users',
|
22
|
+
:action => 'new'
|
23
|
+
map.sign_in 'sign_in',
|
24
|
+
:controller => 'clearance/sessions',
|
25
|
+
:action => 'new'
|
26
|
+
map.sign_out 'sign_out',
|
27
|
+
:controller => 'clearance/sessions',
|
28
|
+
:action => 'destroy',
|
29
|
+
:method => :delete
|
30
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
script/generate clearance
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/lib/rake_commands.rb")
|
3
|
+
require 'factory_girl'
|
4
|
+
|
5
|
+
class ClearanceGenerator < Rails::Generator::Base
|
6
|
+
|
7
|
+
def manifest
|
8
|
+
record do |m|
|
9
|
+
m.insert_into "app/controllers/application_controller.rb",
|
10
|
+
"include Clearance::Authentication"
|
11
|
+
|
12
|
+
user_model = "app/models/user.rb"
|
13
|
+
if File.exists?(user_model)
|
14
|
+
m.insert_into user_model, "include Clearance::User"
|
15
|
+
else
|
16
|
+
m.directory File.join("app", "models")
|
17
|
+
m.file "user.rb", user_model
|
18
|
+
end
|
19
|
+
|
20
|
+
m.directory File.join("test", "factories")
|
21
|
+
m.file "factories.rb", "test/factories/clearance.rb"
|
22
|
+
|
23
|
+
m.migration_template "migrations/#{migration_name}.rb",
|
24
|
+
'db/migrate',
|
25
|
+
:migration_file_name => "clearance_#{migration_name}"
|
26
|
+
|
27
|
+
m.readme "README"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def migration_name
|
34
|
+
if ActiveRecord::Base.connection.table_exists?(:users)
|
35
|
+
'update_users'
|
36
|
+
else
|
37
|
+
'create_users'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# Mostly pinched from http://github.com/ryanb/nifty-generators/tree/master
|
2
|
+
|
3
|
+
Rails::Generator::Commands::Base.class_eval do
|
4
|
+
def file_contains?(relative_destination, line)
|
5
|
+
File.read(destination_path(relative_destination)).include?(line)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
Rails::Generator::Commands::Create.class_eval do
|
10
|
+
def insert_into(file, line)
|
11
|
+
logger.insert "#{line} into #{file}"
|
12
|
+
unless options[:pretend] || file_contains?(file, line)
|
13
|
+
gsub_file file, /^(class|module) .+$/ do |match|
|
14
|
+
"#{match}\n #{line}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
Rails::Generator::Commands::Destroy.class_eval do
|
21
|
+
def insert_into(file, line)
|
22
|
+
logger.remove "#{line} from #{file}"
|
23
|
+
unless options[:pretend]
|
24
|
+
gsub_file file, "\n #{line}", ''
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
Rails::Generator::Commands::List.class_eval do
|
30
|
+
def insert_into(file, line)
|
31
|
+
logger.insert "#{line} into #{file}"
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Rails::Generator::Commands::Create.class_eval do
|
2
|
+
def rake_db_migrate
|
3
|
+
logger.rake "db:migrate"
|
4
|
+
unless system("rake db:migrate")
|
5
|
+
logger.rake "db:migrate failed. Rolling back"
|
6
|
+
command(:destroy).invoke!
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
Rails::Generator::Commands::Destroy.class_eval do
|
12
|
+
def rake_db_migrate
|
13
|
+
logger.rake "db:rollback"
|
14
|
+
system "rake db:rollback"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
Rails::Generator::Commands::List.class_eval do
|
19
|
+
def rake_db_migrate
|
20
|
+
logger.rake "db:migrate"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
*******************************************************************************
|
3
|
+
|
4
|
+
Ok, enough fancy automatic stuff. Time for some old school monkey copy-pasting.
|
5
|
+
|
6
|
+
1. Define a HOST constant in your environments files.
|
7
|
+
In config/environments/test.rb and config/environments/development.rb it can be:
|
8
|
+
|
9
|
+
HOST = "localhost"
|
10
|
+
|
11
|
+
In production.rb it must be the actual host your application is deployed to.
|
12
|
+
The constant is used by mailers to generate URLs in emails.
|
13
|
+
|
14
|
+
2. In config/environment.rb:
|
15
|
+
|
16
|
+
DO_NOT_REPLY = "donotreply@example.com"
|
17
|
+
|
18
|
+
3. Define root_url to *something* in your config/routes.rb:
|
19
|
+
|
20
|
+
map.root :controller => 'home'
|
21
|
+
|
22
|
+
*******************************************************************************
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Factory.sequence :email do |n|
|
2
|
+
"user#{n}@example.com"
|
3
|
+
end
|
4
|
+
|
5
|
+
Factory.define :user do |user|
|
6
|
+
user.email { Factory.next :email }
|
7
|
+
user.password { "password" }
|
8
|
+
user.password_confirmation { "password" }
|
9
|
+
end
|
10
|
+
|
11
|
+
Factory.define :email_confirmed_user, :parent => :user do |user|
|
12
|
+
user.email_confirmed { true }
|
13
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class ClearanceCreateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table(:users) do |t|
|
4
|
+
t.string :email
|
5
|
+
t.string :encrypted_password, :limit => 128
|
6
|
+
t.string :salt, :limit => 128
|
7
|
+
t.string :token, :limit => 128
|
8
|
+
t.datetime :token_expires_at
|
9
|
+
t.boolean :email_confirmed, :default => false, :null => false
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :users, [:id, :token]
|
14
|
+
add_index :users, :email
|
15
|
+
add_index :users, :token
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
drop_table :users
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class ClearanceUpdateUsers < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
<%
|
4
|
+
existing_columns = ActiveRecord::Base.connection.columns(:users).collect { |each| each.name }
|
5
|
+
columns = [
|
6
|
+
[:email, 't.string :email'],
|
7
|
+
[:encrypted_password, 't.string :encrypted_password, :limit => 128'],
|
8
|
+
[:salt, 't.string :salt, :limit => 128'],
|
9
|
+
[:token, 't.string :token, :limit => 128'],
|
10
|
+
[:token_expires_at, 't.datetime :token_expires_at'],
|
11
|
+
[:email_confirmed, 't.boolean :email_confirmed, :default => false, :null => false']
|
12
|
+
].delete_if {|c| existing_columns.include?(c.first.to_s)}
|
13
|
+
-%>
|
14
|
+
change_table(:users) do |t|
|
15
|
+
<% columns.each do |c| -%>
|
16
|
+
<%= c.last %>
|
17
|
+
<% end -%>
|
18
|
+
end
|
19
|
+
|
20
|
+
<%
|
21
|
+
existing_indexes = ActiveRecord::Base.connection.indexes(:users)
|
22
|
+
index_names = existing_indexes.collect { |each| each.name }
|
23
|
+
new_indexes = [
|
24
|
+
[:index_users_on_id_and_token, 'add_index :users, [:id, :token]'],
|
25
|
+
[:index_users_on_email, 'add_index :users, :email'],
|
26
|
+
[:index_users_on_token, 'add_index :users, :token']
|
27
|
+
].delete_if { |each| index_names.include?(each.first.to_s) }
|
28
|
+
-%>
|
29
|
+
<% new_indexes.each do |each| -%>
|
30
|
+
<%= each.last %>
|
31
|
+
<% end -%>
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.down
|
35
|
+
change_table(:users) do |t|
|
36
|
+
<% unless columns.empty? -%>
|
37
|
+
t.remove <%= columns.collect { |each| ":#{each.first}" }.join(',') %>
|
38
|
+
<% end -%>
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
script/generate clearance_features
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class ClearanceFeaturesGenerator < Rails::Generator::Base
|
2
|
+
|
3
|
+
def manifest
|
4
|
+
record do |m|
|
5
|
+
m.directory File.join("features", "step_definitions")
|
6
|
+
m.directory File.join("features", "support")
|
7
|
+
|
8
|
+
["features/step_definitions/clearance_steps.rb",
|
9
|
+
"features/step_definitions/factory_girl_steps.rb",
|
10
|
+
"features/support/paths.rb",
|
11
|
+
"features/sign_in.feature",
|
12
|
+
"features/sign_out.feature",
|
13
|
+
"features/sign_up.feature",
|
14
|
+
"features/password_reset.feature"].each do |file|
|
15
|
+
m.file file, file
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Password reset
|
2
|
+
In order to sign in even if user forgot their password
|
3
|
+
A user
|
4
|
+
Should be able to reset it
|
5
|
+
|
6
|
+
Scenario: User is not signed up
|
7
|
+
Given no user exists with an email of "email@person.com"
|
8
|
+
When I request password reset link to be sent to "email@person.com"
|
9
|
+
Then I should see "Unknown email"
|
10
|
+
|
11
|
+
Scenario: User is signed up and requests password reset
|
12
|
+
Given I signed up with "email@person.com/password"
|
13
|
+
When I request password reset link to be sent to "email@person.com"
|
14
|
+
Then I should see "instructions for changing your password"
|
15
|
+
And a password reset message should be sent to "email@person.com"
|
16
|
+
|
17
|
+
Scenario: User is signed up updated his password and types wrong confirmation
|
18
|
+
Given I signed up with "email@person.com/password"
|
19
|
+
When I follow the password reset link sent to "email@person.com"
|
20
|
+
And I update my password with "newpassword/wrongconfirmation"
|
21
|
+
Then I should see error messages
|
22
|
+
And I should be signed out
|
23
|
+
|
24
|
+
Scenario: User is signed up and updates his password
|
25
|
+
Given I signed up with "email@person.com/password"
|
26
|
+
When I follow the password reset link sent to "email@person.com"
|
27
|
+
And I update my password with "newpassword/newpassword"
|
28
|
+
Then I should be signed in
|
29
|
+
When I sign out
|
30
|
+
Then I should be signed out
|
31
|
+
And I sign in as "email@person.com/newpassword"
|
32
|
+
Then I should be signed in
|
33
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Feature: Sign in
|
2
|
+
In order to get access to protected sections of the site
|
3
|
+
A user
|
4
|
+
Should be able to sign in
|
5
|
+
|
6
|
+
Scenario: User is not signed up
|
7
|
+
Given no user exists with an email of "email@person.com"
|
8
|
+
When I go to the sign in page
|
9
|
+
And I sign in as "email@person.com/password"
|
10
|
+
Then I should see "Bad email or password"
|
11
|
+
And I should be signed out
|
12
|
+
|
13
|
+
Scenario: User is not confirmed
|
14
|
+
Given I signed up with "email@person.com/password"
|
15
|
+
When I go to the sign in page
|
16
|
+
And I sign in as "email@person.com/password"
|
17
|
+
Then I should see "User has not confirmed email"
|
18
|
+
And I should be signed out
|
19
|
+
|
20
|
+
Scenario: User enters wrong password
|
21
|
+
Given I am signed up and confirmed as "email@person.com/password"
|
22
|
+
When I go to the sign in page
|
23
|
+
And I sign in as "email@person.com/wrongpassword"
|
24
|
+
Then I should see "Bad email or password"
|
25
|
+
And I should be signed out
|
26
|
+
|
27
|
+
Scenario: User signs in successfully
|
28
|
+
Given I am signed up and confirmed as "email@person.com/password"
|
29
|
+
When I go to the sign in page
|
30
|
+
And I sign in as "email@person.com/password"
|
31
|
+
Then I should see "Signed in"
|
32
|
+
And I should be signed in
|
33
|
+
|
34
|
+
Scenario: User signs in and checks "remember me"
|
35
|
+
Given I am signed up and confirmed as "email@person.com/password"
|
36
|
+
When I go to the sign in page
|
37
|
+
And I sign in with "remember me" as "email@person.com/password"
|
38
|
+
Then I should see "Signed in"
|
39
|
+
And I should be signed in
|
40
|
+
When I return next time
|
41
|
+
Then I should be signed in
|
42
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Sign out
|
2
|
+
To protect my account from unauthorized access
|
3
|
+
A signed in user
|
4
|
+
Should be able to sign out
|
5
|
+
|
6
|
+
Scenario: User signs out
|
7
|
+
Given I am signed up and confirmed as "email@person.com/password"
|
8
|
+
When I sign in as "email@person.com/password"
|
9
|
+
Then I should be signed in
|
10
|
+
And I sign out
|
11
|
+
Then I should see "Signed out"
|
12
|
+
And I should be signed out
|
13
|
+
|
14
|
+
Scenario: User who was remembered signs out
|
15
|
+
Given I am signed up and confirmed as "email@person.com/password"
|
16
|
+
When I sign in with "remember me" as "email@person.com/password"
|
17
|
+
Then I should be signed in
|
18
|
+
And I sign out
|
19
|
+
Then I should see "Signed out"
|
20
|
+
And I should be signed out
|
21
|
+
When I return next time
|
22
|
+
Then I should be signed out
|
23
|
+
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Feature: Sign up
|
2
|
+
In order to get access to protected sections of the site
|
3
|
+
A user
|
4
|
+
Should be able to sign up
|
5
|
+
|
6
|
+
Scenario: User signs up with invalid data
|
7
|
+
When I go to the sign up page
|
8
|
+
And I fill in "Email" with "invalidemail"
|
9
|
+
And I fill in "Password" with "password"
|
10
|
+
And I fill in "Confirm password" with ""
|
11
|
+
And I press "Sign Up"
|
12
|
+
Then I should see error messages
|
13
|
+
|
14
|
+
Scenario: User signs up with valid data
|
15
|
+
When I go to the sign up page
|
16
|
+
And I fill in "Email" with "email@person.com"
|
17
|
+
And I fill in "Password" with "password"
|
18
|
+
And I fill in "Confirm password" with "password"
|
19
|
+
And I press "Sign Up"
|
20
|
+
Then I should see "instructions for confirming"
|
21
|
+
And a confirmation message should be sent to "email@person.com"
|
22
|
+
|
23
|
+
Scenario: User confirms his account
|
24
|
+
Given I signed up with "email@person.com/password"
|
25
|
+
When I follow the confirmation link sent to "email@person.com"
|
26
|
+
Then I should see "Confirmed email and signed in"
|
27
|
+
And I should be signed in
|
28
|
+
|