mirror of
https://github.com/neocities/neocities.git
synced 2025-08-27 19:33:28 +02:00
manual email verification button
This commit is contained in:
parent
a80248d963
commit
b501872b56
2 changed files with 35 additions and 4 deletions
20
app/admin.rb
20
app/admin.rb
|
@ -277,6 +277,26 @@ post '/admin/feature' do
|
|||
redirect request.referrer
|
||||
end
|
||||
|
||||
post '/admin/verify_email' do
|
||||
require_admin
|
||||
site = Site[username: params[:username]]
|
||||
|
||||
if site.nil?
|
||||
flash[:error] = 'User not found'
|
||||
redirect request.referrer
|
||||
end
|
||||
|
||||
if site.email_confirmed
|
||||
flash[:error] = 'Email is already confirmed'
|
||||
redirect request.referrer
|
||||
end
|
||||
|
||||
site.email_confirmed = true
|
||||
site.save_changes(validate: false)
|
||||
flash[:success] = "Email for #{site.username} has been manually verified."
|
||||
redirect request.referrer
|
||||
end
|
||||
|
||||
get '/admin/masquerade/:username' do
|
||||
require_admin
|
||||
site = Site[username: params[:username]]
|
||||
|
|
|
@ -36,10 +36,6 @@
|
|||
<td>Email</td>
|
||||
<td><%= @site.email %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email Confirmed</td>
|
||||
<td><%= @site.email_confirmed ? '✓ Yes' : '✗ No' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IP Address</td>
|
||||
<td style="overflow-wrap: anywhere;"><%= @site.ip || 'Unknown' %></td>
|
||||
|
@ -126,6 +122,21 @@
|
|||
<td>Blackbox Whitelisted</td>
|
||||
<td><%= @site.blackbox_whitelisted ? '✓ Yes' : '✗ No' %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Email Confirmed</td>
|
||||
<td>
|
||||
<%= @site.email_confirmed ? '✓ Yes' : '✗ No' %>
|
||||
<% unless @site.email_confirmed %>
|
||||
<form action="/admin/verify_email" method="POST" style="display: inline-block; margin-left: 10px;">
|
||||
<input type="hidden" name="username" value="<%= @site.username %>">
|
||||
<input type="hidden" name="_token" value="<%= csrf_token %>">
|
||||
<button type="submit" class="btn btn-Action" style="font-size: 12px; padding: 3px 8px;" onclick="return confirm('Are you sure you want to manually verify this email?');">
|
||||
Verify Manually
|
||||
</button>
|
||||
</form>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="margin-top: 15px;">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue