mirror of https://github.com/mastodon/mastodon
Adding e-mail confirmations
parent
b3c7c8700d
commit
fc198a8b4c
@ -0,0 +1,3 @@
|
||||
class Auth::ConfirmationsController < Devise::ConfirmationsController
|
||||
layout 'auth'
|
||||
end
|
@ -0,0 +1,9 @@
|
||||
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
|
||||
= devise_error_messages!
|
||||
|
||||
.field
|
||||
= f.email_field :email, autofocus: true, required: true, placeholder: 'E-mail address'
|
||||
.actions
|
||||
= f.button "Resend confirmation instructions", type: 'submit'
|
||||
|
||||
.form-footer= render "auth/shared/links"
|
@ -0,0 +1,5 @@
|
||||
<p>Welcome <%= @resource.email %>!</p>
|
||||
|
||||
<p>You can confirm your account email through the link below:</p>
|
||||
|
||||
<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
|
@ -1,25 +0,0 @@
|
||||
<h2>Change your password</h2>
|
||||
|
||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
||||
<%= devise_error_messages! %>
|
||||
<%= f.hidden_field :reset_password_token %>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password, "New password" %><br />
|
||||
<% if @minimum_password_length %>
|
||||
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
||||
<% end %>
|
||||
<%= f.password_field :password, autofocus: true, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
||||
<%= f.password_field :password_confirmation, autocomplete: "off" %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<%= f.submit "Change my password" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render "devise/shared/links" %>
|
@ -0,0 +1,12 @@
|
||||
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
|
||||
= devise_error_messages!
|
||||
= f.hidden_field :reset_password_token
|
||||
|
||||
.field
|
||||
= f.password_field :password, autofocus: true, autocomplete: "off", placeholder: 'New password'
|
||||
.field
|
||||
= f.password_field :password_confirmation, autocomplete: "off", placeholder: 'Confirm new password'
|
||||
.actions
|
||||
= f.button "Change my password", type: :submit
|
||||
|
||||
= render "devise/shared/links"
|
@ -0,0 +1,9 @@
|
||||
class AddConfirmableToUsers < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :users, :confirmation_token, :string
|
||||
add_column :users, :confirmed_at, :datetime
|
||||
add_column :users, :confirmation_sent_at, :datetime
|
||||
add_column :users, :unconfirmed_email, :string
|
||||
add_index :users, :confirmation_token, unique: true
|
||||
end
|
||||
end
|
@ -1,5 +1,6 @@
|
||||
Fabricator(:user) do
|
||||
account
|
||||
email "alice@example.com"
|
||||
password "123456789"
|
||||
email "alice@example.com"
|
||||
password "123456789"
|
||||
confirmed_at { Time.now }
|
||||
end
|
||||
|
Loading…
Reference in New Issue