Skip to content

Commit d267881

Browse files
committed
Third Commit
1 parent a465fec commit d267881

File tree

23 files changed

+579
-2
lines changed

23 files changed

+579
-2
lines changed

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
source 'https://rubygems.org'
22

3+
4+
gem 'devise'
35
gem 'therubyracer'
46
gem 'less-rails'
57
gem 'twitter-bootstrap-rails'

Gemfile.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ GEM
2828
thread_safe (~> 0.1)
2929
tzinfo (~> 1.1)
3030
arel (5.0.1.20140414130214)
31+
bcrypt (3.1.7)
3132
builder (3.2.2)
3233
coffee-rails (4.0.1)
3334
coffee-script (>= 2.2.0)
@@ -37,6 +38,12 @@ GEM
3738
execjs
3839
coffee-script-source (1.7.0)
3940
commonjs (0.2.7)
41+
devise (3.2.4)
42+
bcrypt (~> 3.0)
43+
orm_adapter (~> 0.1)
44+
railties (>= 3.2.6, < 5)
45+
thread_safe (~> 0.1)
46+
warden (~> 1.2.3)
4047
erubis (2.7.0)
4148
execjs (2.2.1)
4249
hike (1.2.3)
@@ -60,6 +67,7 @@ GEM
6067
mime-types (1.25.1)
6168
minitest (5.3.5)
6269
multi_json (1.10.1)
70+
orm_adapter (0.5.0)
6371
polyglot (0.3.5)
6472
rack (1.5.2)
6573
rack-test (0.6.2)
@@ -124,12 +132,15 @@ GEM
124132
uglifier (2.5.1)
125133
execjs (>= 0.3.0)
126134
json (>= 1.8.0)
135+
warden (1.2.3)
136+
rack (>= 1.0)
127137

128138
PLATFORMS
129139
ruby
130140

131141
DEPENDENCIES
132142
coffee-rails (~> 4.0.0)
143+
devise
133144
jbuilder (~> 2.0)
134145
jquery-rails
135146
less-rails

app/models/user.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class User < ActiveRecord::Base
2+
# Include default devise modules. Others available are:
3+
# :confirmable, :lockable, :timeoutable and :omniauthable
4+
devise :database_authenticatable, :registerable,
5+
:recoverable, :rememberable, :trackable, :validatable
6+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<h2>Resend confirmation instructions</h2>
2+
3+
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
4+
<%= devise_error_messages! %>
5+
6+
<div><%= f.label :email %><br />
7+
<%= f.email_field :email, autofocus: true %></div>
8+
9+
<div><%= f.submit "Resend confirmation instructions" %></div>
10+
<% end %>
11+
12+
<%= render "devise/shared/links" %>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<p>Welcome <%= @email %>!</p>
2+
3+
<p>You can confirm your account email through the link below:</p>
4+
5+
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<p>Hello <%= @resource.email %>!</p>
2+
3+
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
4+
5+
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
6+
7+
<p>If you didn't request this, please ignore this email.</p>
8+
<p>Your password won't change until you access the link above and create a new one.</p>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<p>Hello <%= @resource.email %>!</p>
2+
3+
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
4+
5+
<p>Click the link below to unlock your account:</p>
6+
7+
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<h2>Change your password</h2>
2+
3+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
4+
<%= devise_error_messages! %>
5+
<%= f.hidden_field :reset_password_token %>
6+
7+
<div><%= f.label :password, "New password" %><br />
8+
<%= f.password_field :password, autofocus: true, autocomplete: "off" %></div>
9+
10+
<div><%= f.label :password_confirmation, "Confirm new password" %><br />
11+
<%= f.password_field :password_confirmation, autocomplete: "off" %></div>
12+
13+
<div><%= f.submit "Change my password" %></div>
14+
<% end %>
15+
16+
<%= render "devise/shared/links" %>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<h2>Forgot your password?</h2>
2+
3+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
4+
<%= devise_error_messages! %>
5+
6+
<div><%= f.label :email %><br />
7+
<%= f.email_field :email, autofocus: true %></div>
8+
9+
<div><%= f.submit "Send me reset password instructions" %></div>
10+
<% end %>
11+
12+
<%= render "devise/shared/links" %>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
2+
3+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
4+
<%= devise_error_messages! %>
5+
6+
<div><%= f.label :email %><br />
7+
<%= f.email_field :email, autofocus: true %></div>
8+
9+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
10+
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
11+
<% end %>
12+
13+
<div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
14+
<%= f.password_field :password, autocomplete: "off" %></div>
15+
16+
<div><%= f.label :password_confirmation %><br />
17+
<%= f.password_field :password_confirmation, autocomplete: "off" %></div>
18+
19+
<div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
20+
<%= f.password_field :current_password, autocomplete: "off" %></div>
21+
22+
<div><%= f.submit "Update" %></div>
23+
<% end %>
24+
25+
<h3>Cancel my account</h3>
26+
27+
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
28+
29+
<%= link_to "Back", :back %>

0 commit comments

Comments
 (0)