Skip to content

Commit 474d072

Browse files
hide login buttons
1 parent dba149c commit 474d072

3 files changed

Lines changed: 6 additions & 76 deletions

File tree

app/rodauth/hacker_rodauth_plugin.rb

Lines changed: 3 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ class HackerRodauthPlugin < RodauthPlugin
1717
:login,
1818
:remember,
1919
:logout,
20-
:create_account,
21-
:verify_account,
22-
:verify_account_grace_period,
23-
:reset_password,
24-
:reset_password_notify,
25-
:change_login,
26-
:verify_login_change,
27-
:change_password,
28-
:change_password_notify,
2920
:case_insensitive_login,
3021
:internal_request
3122
)
@@ -47,9 +38,6 @@ class HackerRodauthPlugin < RodauthPlugin
4738
# Change prefix of table and foreign key column names from default "account"
4839
accounts_table :hackers
4940
remember_table :hacker_remember_keys
50-
reset_password_table :hacker_password_reset_keys
51-
verify_account_table :hacker_verification_keys
52-
verify_login_change_table :hacker_login_change_keys
5341

5442
# The secret key used for hashing public-facing tokens for various features.
5543
# Defaults to Rails `secret_key_base`, but you can use your own secret key.
@@ -73,7 +61,6 @@ class HackerRodauthPlugin < RodauthPlugin
7361
# Change some default param keys.
7462
login_param "email"
7563
login_label "Email"
76-
# password_confirm_param "confirm_password"
7764

7865
# Redirect back to originally requested location after authentication.
7966
login_return_to_requested_location? true
@@ -92,38 +79,6 @@ class HackerRodauthPlugin < RodauthPlugin
9279
# Requires the JSON feature
9380
# only_json? false
9481

95-
# ==> Emails
96-
# Use a custom mailer for delivering authentication emails.
97-
98-
create_reset_password_email do
99-
Rodauth::HackerMailer.reset_password(self.class.configuration_name,
100-
account_id, reset_password_key_value)
101-
end
102-
103-
create_verify_account_email do
104-
Rodauth::HackerMailer.verify_account(self.class.configuration_name,
105-
account_id, verify_account_key_value)
106-
end
107-
108-
create_verify_login_change_email do |_login|
109-
Rodauth::HackerMailer.verify_login_change(
110-
self.class.configuration_name,
111-
account_id,
112-
verify_login_change_key_value
113-
)
114-
end
115-
116-
create_password_changed_email do
117-
Rodauth::HackerMailer.change_password_notify(
118-
self.class.configuration_name, account_id
119-
)
120-
end
121-
122-
create_reset_password_notify_email do
123-
Rodauth::HackerMailer.reset_password_notify(
124-
self.class.configuration_name, account_id
125-
)
126-
end
12782

12883
send_email do |email|
12984
# queue email delivery on the mailer after the transaction commits
@@ -151,25 +106,6 @@ class HackerRodauthPlugin < RodauthPlugin
151106

152107
# ==> Passwords
153108

154-
# Passwords shorter than 8 characters are considered weak according to OWASP.
155-
password_minimum_length 8
156-
157-
# Custom password complexity requirements (alternative to password_complexity feature).
158-
# password_meets_requirements? do |password|
159-
# super(password) && password_complex_enough?(password)
160-
# end
161-
# auth_class_eval do
162-
# def password_complex_enough?(password)
163-
# return true if password.match?(/\d/) && password.match?(/[^a-zA-Z\d]/)
164-
# set_password_requirement_error_message(:password_simple, "requires one number and one special character")
165-
# false
166-
# end
167-
# end
168-
169-
# = bcrypt
170-
171-
# bcrypt has a maximum input length of 72 bytes, truncating any extra bytes.
172-
password_maximum_bytes 72 if respond_to?(:password_maximum_bytes)
173109

174110
# ==> Remember Feature
175111

@@ -211,24 +147,18 @@ class HackerRodauthPlugin < RodauthPlugin
211147
# Profile.find_by!(account_id: account_id).destroy
212148
# end
213149

214-
create_account_route "register"
215150

216151
# ==> Redirects
217152

218-
# Redirect to home after login.
219-
create_account_redirect "/hacker_dashboard"
153+
# Redirect to dashboard after omniauth login/create
154+
after_omniauth_create_account { redirect "/hacker_dashboard" }
220155

221156
# Redirect to home after login.
222157
login_redirect "/hacker_dashboard"
223158

224159
# Redirect to home page after logout.
225-
logout_redirect "/"
226-
227-
# Redirect to wherever login redirects to after account verification.
228-
verify_account_redirect { login_redirect }
160+
logout_redirect "/hacker_dashboard"
229161

230-
# Redirect to login page after password reset.
231-
reset_password_redirect { login_path }
232162
# ==> Deadlines
233163
# Change default deadlines for some actions.
234164
# verify_account_grace_period 3.days.to_i

app/views/rodauth/hacker/_login_form.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
<h1
33
class="
44
text-md leading-tight tracking-tight text-gray-900 md:text-lg dark:text-white
5-
text-center
5+
text-center hidden
66
"
77
>
88
Sign in to your account
99
</h1>
10-
<%= form_with url: rodauth(:hacker).login_path, method: :post, data: { turbo: false }, class: "space-y-4" do |form| %>
10+
<%= form_with url: rodauth(:hacker).login_path, method: :post, data: { turbo: false }, class: "space-y-4 hidden" do |form| %>
1111
<div>
1212
<%= form.label "login",
1313
rodauth(:hacker).login_label,

app/views/rodauth/hacker/_omniauth_links.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<%= @google_text %>
2828
<% end %>
2929

30-
<div class="flex items-center my-4">
30+
<div class="flex items-center my-4 hidden">
3131
<div class="flex-grow border-t border-gray-300"></div>
3232
<span class="px-4 dark:text-white text-gray-700">or</span>
3333
<div class="flex-grow border-t border-gray-300"></div>

0 commit comments

Comments
 (0)