administration-zero 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/administration_zero/version.rb +1 -1
- data/lib/generators/admin/install/templates/controllers/admin/password_resets_controller.rb +1 -1
- data/lib/generators/admin/install/templates/controllers/admin/sessions_controller.rb +0 -1
- data/lib/generators/admin/install/templates/erb/admin/application/_flash_messages.html.erb +3 -1
- data/lib/generators/admin/install/templates/erb/admin/application/_page_header_breadcrumb.html.erb +2 -2
- data/lib/generators/admin/install/templates/erb/admin/password_resets/edit.html.erb +1 -1
- data/lib/generators/admin/install/templates/erb/admin/password_resets/new.html.erb +1 -1
- data/lib/generators/admin/install/templates/erb/admin/sessions/new.html.erb +1 -1
- data/lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset.html.erb +14 -0
- data/lib/generators/admin/install/templates/erb/admin/user_mailer/{password_reset_provision.text.erb → password_reset.text.erb} +0 -0
- data/lib/generators/admin/install/templates/mailers/admin/application_mailer.rb +0 -1
- data/lib/generators/admin/install/templates/mailers/admin/user_mailer.rb +1 -1
- data/lib/generators/admin/install/templates/migrations/create_admin_users.rb.tt +2 -2
- data/lib/generators/admin/install/templates/models/admin/application_record.rb +1 -4
- data/lib/generators/admin/install/templates/models/admin/user.rb +3 -6
- data/lib/generators/admin/install/templates/test_unit/application_system_test_case.rb +1 -1
- data/lib/generators/admin/install/templates/test_unit/controllers/admin/home_controller_test.rb +1 -1
- data/lib/generators/admin/install/templates/test_unit/controllers/admin/password_resets_controller_test.rb +1 -1
- data/lib/generators/admin/install/templates/test_unit/controllers/admin/sessions_controller_test.rb +1 -1
- data/lib/generators/admin/install/templates/test_unit/controllers/admin/users_controller_test.rb +1 -1
- data/lib/generators/admin/install/templates/test_unit/system/admin/sessions_test.rb +1 -1
- data/lib/generators/admin/install/templates/test_unit/system/admin/users_test.rb +1 -1
- data/lib/generators/admin/install/templates/test_unit/test_helper.rb +1 -1
- data/lib/generators/admin/scaffold/templates/functional_test.rb.tt +1 -1
- data/lib/generators/admin/scaffold/templates/system_test.rb.tt +1 -1
- metadata +4 -4
- data/lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset_provision.html.erb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfad604f4745dd7570ce2d3312be76883c4628d78b68f9cf73e895524e3a5b09
|
4
|
+
data.tar.gz: 8075becb0053683c3829418f3638203ec18e68c8457889e991d0f00330272c79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 232ad1c394f2587baab5d9756a9bbd5a5aeb7a2367a62e650a7005ac8f65159d9394871295005aaa54834e69c53ce272d8366faec645498981b81f1770d88403
|
7
|
+
data.tar.gz: e19a765822a158ff63482d267ab4d3e231ca5024f21abf239ac783f4818d3629c6731bb1967c5a7b674992ea404b0b38efdecf341f1e8da92e71a07577878aee
|
data/Gemfile.lock
CHANGED
@@ -13,7 +13,7 @@ class Admin::PasswordResetsController < Admin::ApplicationController
|
|
13
13
|
|
14
14
|
def create
|
15
15
|
if @admin_user = Admin::User.find_by(email: params[:email])
|
16
|
-
Admin::UserMailer.with(admin_user: @admin_user).
|
16
|
+
Admin::UserMailer.with(admin_user: @admin_user).password_reset.deliver_later
|
17
17
|
redirect_to admin_sign_in_path, notice: "Check your email for reset instructions"
|
18
18
|
else
|
19
19
|
redirect_to new_admin_password_reset_path, alert: "Sorry, we didn't recognize that email address"
|
@@ -12,7 +12,6 @@ class Admin::SessionsController < Admin::ApplicationController
|
|
12
12
|
|
13
13
|
if @admin_user && @admin_user.authenticate(params[:password])
|
14
14
|
session[:admin_user_id] = @admin_user.id
|
15
|
-
|
16
15
|
redirect_to admin_path
|
17
16
|
else
|
18
17
|
redirect_to admin_sign_in_path(email_hint: params[:email]), alert: "That email or password is incorrect"
|
@@ -1,4 +1,6 @@
|
|
1
|
-
<%
|
1
|
+
<% message = notice || alert %>
|
2
|
+
|
3
|
+
<% if message %>
|
2
4
|
<div class="position-fixed start-50 translate-middle-x" style="z-index: 1030; top: 8rem;">
|
3
5
|
<div class="toast hide text-center text-white bg-dark border-0" data-controller="flash-message">
|
4
6
|
<div class="toast-body">
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= form_with(url: admin_password_reset_path, method: :patch, class: "card card-md") do |form| %>
|
2
2
|
<div class="card-body">
|
3
|
-
<
|
3
|
+
<h1 class="card-title text-center mb-4">Reset password</h1>
|
4
4
|
|
5
5
|
<%= hidden_field_tag :token, params[:token] %>
|
6
6
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= form_with(url: admin_password_reset_path, class: "card card-md") do |form| %>
|
2
2
|
<div class="card-body">
|
3
|
-
<
|
3
|
+
<h1 class="card-title text-center mb-4">Forgot password</h1>
|
4
4
|
<p class="text-muted mb-4">Enter your email address and your password will be reset and emailed to you.</p>
|
5
5
|
<div class="mb-3">
|
6
6
|
<%= form.label :email, class: "form-label" %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= form_with(url: admin_sign_in_path, class: "card card-md") do |form| %>
|
2
2
|
<div class="card-body">
|
3
|
-
<
|
3
|
+
<h1 class="card-title text-center mb-4">Login to your account</h1>
|
4
4
|
<div class="mb-3">
|
5
5
|
<%= form.label :email, class: "form-label" %>
|
6
6
|
<%= form.email_field :email, value: params[:email_hint], placeholder: "Enter email", autofocus: true, required: true, autocomplete: "email", class:"form-control" %>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<p>Hey there,</p>
|
8
|
+
<p>Can't remember your password for <strong><%= @admin_user.email %></strong>? That's OK, it happens. Just hit the link below to set a new one.</p>
|
9
|
+
<p><%= link_to "Reset my password", edit_admin_password_reset_url(token: @signed_id) %></p>
|
10
|
+
<p>If you did not request a password reset you can safely ignore this email, it expires in 20 minutes. Only someone with access to this email account can reset your password.</p>
|
11
|
+
<hr>
|
12
|
+
<p>Have questions or need help? Just reply to this email and our support team will help you sort it out.</p>
|
13
|
+
</body>
|
14
|
+
</html>
|
File without changes
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
2
2
|
def change
|
3
3
|
create_table :admin_users do |t|
|
4
|
-
t.string :email
|
5
|
-
t.string :password_digest
|
4
|
+
t.string :email, null: false
|
5
|
+
t.string :password_digest, null: false
|
6
6
|
|
7
7
|
t.timestamps
|
8
8
|
end
|
@@ -1,13 +1,10 @@
|
|
1
1
|
class Admin::User < Admin::ApplicationRecord
|
2
2
|
has_secure_password
|
3
3
|
|
4
|
-
validates :email, presence: true, uniqueness: true
|
5
|
-
|
6
|
-
|
7
|
-
validates_length_of :password, minimum: 12, allow_nil: true
|
8
|
-
validates_format_of :password, with: /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/, allow_nil: true, message: "might easily be guessed"
|
4
|
+
validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
5
|
+
validates :password, allow_nil: true, length: { minimum: 12 }, format: { with: /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ }
|
9
6
|
|
10
7
|
before_validation do
|
11
|
-
self.email = email.downcase.strip
|
8
|
+
self.email = email.try(:downcase).try(:strip)
|
12
9
|
end
|
13
10
|
end
|
@@ -3,7 +3,7 @@ require "test_helper"
|
|
3
3
|
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
4
4
|
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
|
5
5
|
|
6
|
-
def
|
6
|
+
def sign_in_admin_as(user)
|
7
7
|
visit admin_sign_in_url
|
8
8
|
fill_in :email, with: user.email
|
9
9
|
fill_in :password, with: "Secret1*3*5*"
|
@@ -18,7 +18,7 @@ class Admin::PasswordResetsControllerTest < ActionDispatch::IntegrationTest
|
|
18
18
|
end
|
19
19
|
|
20
20
|
test "should send a password reset email" do
|
21
|
-
assert_enqueued_email_with Admin::UserMailer, :
|
21
|
+
assert_enqueued_email_with Admin::UserMailer, :password_reset, args: { admin_user: @admin_user } do
|
22
22
|
post admin_password_reset_url, params: { email: @admin_user.email }
|
23
23
|
end
|
24
24
|
|
@@ -10,7 +10,7 @@ class ActiveSupport::TestCase
|
|
10
10
|
fixtures :all
|
11
11
|
|
12
12
|
# Add more helper methods to be used by all tests here...
|
13
|
-
def
|
13
|
+
def sign_in_admin_as(user)
|
14
14
|
post(admin_sign_in_url, params: { email: user.email, password: "Secret1*3*5*" }); user
|
15
15
|
end
|
16
16
|
end
|
@@ -6,7 +6,7 @@ class <%= controller_class_name %>ControllerTest < ActionDispatch::IntegrationTe
|
|
6
6
|
|
7
7
|
<%- end -%>
|
8
8
|
setup do
|
9
|
-
@admin_user =
|
9
|
+
@admin_user = sign_in_admin_as admin_users(:lazaro_nixon)
|
10
10
|
@<%= singular_table_name %> = <%= fixture_name %>(:one)
|
11
11
|
end
|
12
12
|
|
@@ -2,7 +2,7 @@ require "application_system_test_case"
|
|
2
2
|
|
3
3
|
class <%= class_name.pluralize %>Test < ApplicationSystemTestCase
|
4
4
|
setup do
|
5
|
-
@admin_user =
|
5
|
+
@admin_user = sign_in_admin_as(admin_users(:lazaro_nixon))
|
6
6
|
@<%= singular_table_name %> = <%= fixture_name %>(:one)
|
7
7
|
end
|
8
8
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administration-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -52,8 +52,8 @@ files:
|
|
52
52
|
- lib/generators/admin/install/templates/erb/admin/password_resets/edit.html.erb
|
53
53
|
- lib/generators/admin/install/templates/erb/admin/password_resets/new.html.erb
|
54
54
|
- lib/generators/admin/install/templates/erb/admin/sessions/new.html.erb
|
55
|
-
- lib/generators/admin/install/templates/erb/admin/user_mailer/
|
56
|
-
- lib/generators/admin/install/templates/erb/admin/user_mailer/
|
55
|
+
- lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset.html.erb
|
56
|
+
- lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset.text.erb
|
57
57
|
- lib/generators/admin/install/templates/erb/admin/users/_form.html.erb
|
58
58
|
- lib/generators/admin/install/templates/erb/admin/users/edit.html.erb
|
59
59
|
- lib/generators/admin/install/templates/erb/admin/users/index.html.erb
|
data/lib/generators/admin/install/templates/erb/admin/user_mailer/password_reset_provision.html.erb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
<p>Hey there,</p>
|
2
|
-
|
3
|
-
<p>Can't remember your password for <strong><%= @admin_user.email %></strong>? That's OK, it happens. Just hit the link below to set a new one.</p>
|
4
|
-
|
5
|
-
<p><%= link_to "Reset my password", edit_admin_password_reset_url(token: @signed_id) %></p>
|
6
|
-
|
7
|
-
<p>If you did not request a password reset you can safely ignore this email, it expires in 20 minutes. Only someone with access to this email account can reset your password.</p>
|
8
|
-
|
9
|
-
<hr>
|
10
|
-
|
11
|
-
<p>Have questions or need help? Just reply to this email and our support team will help you sort it out.</p>
|