Skip to content

Commit 93b879e

Browse files
author
alex
committed
feat: add name to user
rails generate migration add_name_to_user name:string
1 parent fe957b5 commit 93b879e

18 files changed

+259
-7
lines changed

app/views/common/_user_nav.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<%= link_to 'Sign in', new_user_session_path %>
44
<%= link_to 'Sign up', new_user_registration_path %>
55
<% else %>
6-
Hi! <%= current_user.email %>
6+
Hi! <%= current_user.name %>
77
<%= link_to 'Sign out', destroy_user_session_path, :method => :delete %>
88
<% end %>
99
</div>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<%= render "devise/shared/error_messages", resource: resource %>
5+
6+
<div class="field">
7+
<%= f.label :email %><br />
8+
<%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
9+
</div>
10+
11+
<div class="actions">
12+
<%= f.submit "Resend confirmation instructions" %>
13+
</div>
14+
<% end %>
15+
16+
<%= 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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<p>Hello <%= @email %>!</p>
2+
3+
<% if @resource.try(:unconfirmed_email?) %>
4+
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
5+
<% else %>
6+
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
7+
<% end %>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<p>Hello <%= @resource.email %>!</p>
2+
3+
<p>We're contacting you to notify you that your password has been changed.</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: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
<%= render "devise/shared/error_messages", resource: resource %>
5+
<%= f.hidden_field :reset_password_token %>
6+
7+
<div class="field">
8+
<%= f.label :password, "New password" %><br />
9+
<% if @minimum_password_length %>
10+
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
11+
<% end %>
12+
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
13+
</div>
14+
15+
<div class="field">
16+
<%= f.label :password_confirmation, "Confirm new password" %><br />
17+
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
18+
</div>
19+
20+
<div class="actions">
21+
<%= f.submit "Change my password" %>
22+
</div>
23+
<% end %>
24+
25+
<%= render "devise/shared/links" %>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<%= render "devise/shared/error_messages", resource: resource %>
5+
6+
<div class="field">
7+
<%= f.label :email %><br />
8+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9+
</div>
10+
11+
<div class="actions">
12+
<%= f.submit "Send me reset password instructions" %>
13+
</div>
14+
<% end %>
15+
16+
<%= render "devise/shared/links" %>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
<%= render "devise/shared/error_messages", resource: resource %>
5+
6+
<div class="field">
7+
<%= f.label :email %><br />
8+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
9+
</div>
10+
11+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
12+
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
13+
<% end %>
14+
15+
<div class="field">
16+
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
17+
<%= f.password_field :password, autocomplete: "new-password" %>
18+
<% if @minimum_password_length %>
19+
<br />
20+
<em><%= @minimum_password_length %> characters minimum</em>
21+
<% end %>
22+
</div>
23+
24+
<div class="field">
25+
<%= f.label :password_confirmation %><br />
26+
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
27+
</div>
28+
29+
<div class="field">
30+
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
31+
<%= f.password_field :current_password, autocomplete: "current-password" %>
32+
</div>
33+
34+
<div class="actions">
35+
<%= f.submit "Update" %>
36+
</div>
37+
<% end %>
38+
39+
<h3>Cancel my account</h3>
40+
41+
<div>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %></div>
42+
43+
<%= link_to "Back", :back %>

0 commit comments

Comments
 (0)