Replace hardcoded domains with primary domain setting

This commit is contained in:
Râu Cao 2023-03-18 13:43:23 +07:00
parent 34e4cec503
commit 589e46bc63
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
8 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ class Admin::UsersController < Admin::BaseController
def index
ldap = LdapService.new
@ou = params[:ou] || "kosmos.org"
@ou = params[:ou] || Setting.primary_domain
@orgs = ldap.fetch_organizations
@pagy, @users = pagy(User.where(ou: @ou).order(cn: :asc))

View File

@ -88,7 +88,7 @@ class SignupController < ApplicationController
if session[:new_user].present?
@user = User.new(session[:new_user])
else
@user = User.new(ou: "kosmos.org")
@user = User.new(ou: Setting.primary_domain)
end
end
@ -98,7 +98,7 @@ class SignupController < ApplicationController
CreateAccount.call(
username: @user.cn,
domain: "kosmos.org",
domain: Setting.primary_domain,
email: @user.email,
password: @user.password,
invitation: @invitation

View File

@ -30,7 +30,7 @@ class WebhooksController < ApplicationController
def notify_xmpp(address, amt_sats, memo)
payload = {
type: "normal",
from: "kosmos.org", # TODO domain config
from: Setting.primary_domain,
to: address,
subject: "Sats received!",
body: "#{helpers.number_with_delimiter amt_sats} sats received in your Lightning wallet:\n> #{memo}"

View File

@ -1,7 +1,7 @@
class CreateAccount < ApplicationService
def initialize(args)
@username = args[:username]
@domain = args[:ou] || "kosmos.org"
@domain = args[:ou] || Setting.primary_domain
@email = args[:email]
@password = args[:password]
@invitation = args[:invitation]

View File

@ -12,7 +12,7 @@
<section class="sm:w-1/2 grid grid-cols-2 items-center gap-y-2">
<%= form.label :user_id %>
<%= form.collection_select :user_id, User.where(ou: "kosmos.org").order(:cn), :id, :cn, {} %>
<%= form.collection_select :user_id, User.where(ou: Setting.primary_domain).order(:cn), :id, :cn, {} %>
<%= form.label :amount_sats, "Amount BTC (sats)" %>
<%= form.number_field :amount_sats %>

View File

@ -10,7 +10,7 @@
<p class="flex gap-2 items-center">
<%= f.text_field :cn, autofocus: true, autocomplete: "username",
required: true, class: "relative grow"%>
<span class="relative shrink-0 text-gray-500">@ kosmos.org</span>
<span class="relative shrink-0 text-gray-500">@ <%= Setting.primary_domain %></span>
</p>
</div>
<p>

View File

@ -14,7 +14,7 @@
<p class="flex gap-2 items-center">
<%= f.text_field :cn, autofocus: true, autocomplete: "username",
required: true, class: "relative grow", tabindex: "1" %>
<span class="relative shrink-0 text-gray-500">@ kosmos.org</span>
<span class="relative shrink-0 text-gray-500">@ <%= Setting.primary_domain %></span>
</p>
</div>
<p class="mb-8">

View File

@ -10,7 +10,7 @@
<%= f.text_field :cn, autofocus: true, autocomplete: "username",
required: true, class: "relative grow text-xl"%>
<span class="relative shrink-0 text-gray-500 md:text-xl">
@ kosmos.org
@ <%= Setting.primary_domain %>
</span>
</p>
</div>