parent
7e93da3f8d
commit
6045b6cb18
19 changed files with 398 additions and 17 deletions
After Width: | Height: | Size: 1.3 MiB |
@ -0,0 +1,34 @@ |
|||||||
|
class Auth::PasswordsController < Devise::PasswordsController |
||||||
|
layout 'auth' |
||||||
|
|
||||||
|
# GET /resource/password/new |
||||||
|
# def new |
||||||
|
# super |
||||||
|
# end |
||||||
|
|
||||||
|
# POST /resource/password |
||||||
|
# def create |
||||||
|
# super |
||||||
|
# end |
||||||
|
|
||||||
|
# GET /resource/password/edit?reset_password_token=abcdef |
||||||
|
# def edit |
||||||
|
# super |
||||||
|
# end |
||||||
|
|
||||||
|
# PUT /resource/password |
||||||
|
# def update |
||||||
|
# super |
||||||
|
# end |
||||||
|
|
||||||
|
# protected |
||||||
|
|
||||||
|
# def after_resetting_password_path_for(resource) |
||||||
|
# super(resource) |
||||||
|
# end |
||||||
|
|
||||||
|
# The path used after sending reset password instructions |
||||||
|
# def after_sending_reset_password_instructions_path_for(resource_name) |
||||||
|
# super(resource_name) |
||||||
|
# end |
||||||
|
end |
@ -0,0 +1,22 @@ |
|||||||
|
class Auth::RegistrationsController < Devise::RegistrationsController |
||||||
|
layout 'auth' |
||||||
|
|
||||||
|
before_filter :configure_sign_up_params, only: [:create] |
||||||
|
|
||||||
|
protected |
||||||
|
|
||||||
|
def build_resource(hash = nil) |
||||||
|
super(hash) |
||||||
|
self.resource.build_account if self.resource.account.nil? |
||||||
|
end |
||||||
|
|
||||||
|
def configure_sign_up_params |
||||||
|
devise_parameter_sanitizer.for(:sign_up) do |u| |
||||||
|
u.permit(:email, :password, :password_confirmation, account_attributes: [:username]) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
def after_sign_up_path_for(resource) |
||||||
|
account_path(resource.account) |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,27 @@ |
|||||||
|
class Auth::SessionsController < Devise::SessionsController |
||||||
|
layout 'auth' |
||||||
|
|
||||||
|
# before_filter :configure_sign_in_params, only: [:create] |
||||||
|
|
||||||
|
# GET /resource/sign_in |
||||||
|
# def new |
||||||
|
# super |
||||||
|
# end |
||||||
|
|
||||||
|
# POST /resource/sign_in |
||||||
|
# def create |
||||||
|
# super |
||||||
|
# end |
||||||
|
|
||||||
|
# DELETE /resource/sign_out |
||||||
|
# def destroy |
||||||
|
# super |
||||||
|
# end |
||||||
|
|
||||||
|
# protected |
||||||
|
|
||||||
|
# If you have extra params to permit, append them to the sanitizer. |
||||||
|
# def configure_sign_in_params |
||||||
|
# devise_parameter_sanitizer.for(:sign_in) << :attribute |
||||||
|
# end |
||||||
|
end |
@ -0,0 +1,3 @@ |
|||||||
|
<p>Hello <%= @resource.email %>!</p> |
||||||
|
|
||||||
|
<p>We're contacting you to notify you that your password has been changed.</p> |
@ -0,0 +1,8 @@ |
|||||||
|
<p>Hello <%= @resource.email %>!</p> |
||||||
|
|
||||||
|
<p>Someone has requested a link to change your password. You can do this through the link below.</p> |
||||||
|
|
||||||
|
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p> |
||||||
|
|
||||||
|
<p>If you didn't request this, please ignore this email.</p> |
||||||
|
<p>Your password won't change until you access the link above and create a new one.</p> |
@ -0,0 +1,25 @@ |
|||||||
|
<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,9 @@ |
|||||||
|
= form_for(resource, as: resource_name, url: password_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 "Reset password", type: 'submit' |
||||||
|
|
||||||
|
.form-footer= render "auth/shared/links" |
@ -0,0 +1,11 @@ |
|||||||
|
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| |
||||||
|
= devise_error_messages! |
||||||
|
|
||||||
|
.field |
||||||
|
= f.password_field :password, autocomplete: "off", placeholder: 'New password' |
||||||
|
.field |
||||||
|
= f.password_field :password_confirmation, autocomplete: "off", placeholder: 'Confirm new password' |
||||||
|
.field |
||||||
|
= f.password_field :current_password, autocomplete: "off", placeholder: 'Current password' |
||||||
|
.actions |
||||||
|
= f.button "Save changes", type: 'submit' |
@ -0,0 +1,17 @@ |
|||||||
|
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| |
||||||
|
= devise_error_messages! |
||||||
|
|
||||||
|
= f.fields_for :account do |ff| |
||||||
|
.field |
||||||
|
= ff.text_field :username, autofocus: true, placeholder: 'Username', required: true |
||||||
|
|
||||||
|
.field |
||||||
|
= f.email_field :email, placeholder: 'E-mail address', required: true |
||||||
|
.field |
||||||
|
= f.password_field :password, autocomplete: "off", placeholder: 'Password', required: true |
||||||
|
.field |
||||||
|
= f.password_field :password_confirmation, autocomplete: "off", placeholder: 'Confirm password', required: true |
||||||
|
.actions |
||||||
|
= f.button "Sign up", type: 'submit' |
||||||
|
|
||||||
|
.form-footer= render "auth/shared/links" |
@ -0,0 +1,9 @@ |
|||||||
|
= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| |
||||||
|
.field |
||||||
|
= f.email_field :email, autofocus: true, placeholder: 'E-mail address', required: true |
||||||
|
.field |
||||||
|
= f.password_field :password, autocomplete: "off", placeholder: 'Password', required: true |
||||||
|
.actions |
||||||
|
= f.button "Log in", type: 'submit' |
||||||
|
|
||||||
|
.form-footer= render "auth/shared/links" |
@ -0,0 +1,19 @@ |
|||||||
|
%ul.no-list |
||||||
|
- if controller_name != 'sessions' |
||||||
|
%li= link_to "Log in", new_session_path(resource_name) |
||||||
|
|
||||||
|
- if devise_mapping.registerable? && controller_name != 'registrations' |
||||||
|
%li= link_to "Sign up", new_registration_path(resource_name) |
||||||
|
|
||||||
|
- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' |
||||||
|
%li= link_to "Forgot your password?", new_password_path(resource_name) |
||||||
|
|
||||||
|
- if devise_mapping.confirmable? && controller_name != 'confirmations' |
||||||
|
%li= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) |
||||||
|
|
||||||
|
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' |
||||||
|
%li= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) |
||||||
|
|
||||||
|
- if devise_mapping.omniauthable? |
||||||
|
- resource_class.omniauth_providers.each do |provider| |
||||||
|
%li= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) |
@ -1 +1,3 @@ |
|||||||
Mastodon |
Mastodon |
||||||
|
|
||||||
|
= link_to 'Logout', destroy_user_session_path, method: :delete |
||||||
|
@ -0,0 +1,10 @@ |
|||||||
|
- content_for :content do |
||||||
|
.logo-container |
||||||
|
%h1 |
||||||
|
Mastodon |
||||||
|
%small= Rails.configuration.x.local_domain |
||||||
|
|
||||||
|
.form-container |
||||||
|
= yield |
||||||
|
|
||||||
|
= render template: "layouts/application" |
Loading…
Reference in new issue