Compare commits
171 Commits
v0.1.0
...
9636671d57
| Author | SHA1 | Date | |
|---|---|---|---|
|
9636671d57
|
|||
|
51cddd94f5
|
|||
|
123e7aa2a1
|
|||
|
3596955642
|
|||
|
562b16cf89
|
|||
|
830c634f88
|
|||
|
2a793e9201
|
|||
|
e571ed9429
|
|||
|
a67f3e466b
|
|||
|
ff3013f917
|
|||
|
0fa6c1a211
|
|||
|
30b2646b85
|
|||
|
f8b86b0a22
|
|||
| b71a2fa643 | |||
|
eda1f3999f
|
|||
|
c06e58a0fb
|
|||
|
c33637003e
|
|||
|
836bd0a977
|
|||
|
8578fbdad9
|
|||
|
878eac083c
|
|||
|
05da7f5dac
|
|||
|
87e3b1a76c
|
|||
|
32f02cc18a
|
|||
|
1b17cfb396
|
|||
| e5aa5a665c | |||
| d37b68a6e5 | |||
|
56936916ff
|
|||
|
c93a460cff
|
|||
| f5ceda35c1 | |||
|
eb0439d6dc
|
|||
|
c3dde3506e
|
|||
| f22ffe373c | |||
|
bc20e89617
|
|||
| 0f0f296a5e | |||
|
78aea5d608
|
|||
|
f1d3e3d8ec
|
|||
| 2706c76890 | |||
| 17f5eb56cd | |||
| aa6b677b13 | |||
|
9abdab2274
|
|||
|
dd49d1208f
|
|||
|
db9118cb7c
|
|||
|
89913ba60b
|
|||
|
8cf631fd94
|
|||
| d0b359039b | |||
|
84cf523049
|
|||
| a7390ba00b | |||
|
67d148d117
|
|||
|
83ad6f4eef
|
|||
|
2e31268698
|
|||
|
f3b22c02ef
|
|||
| dbe65b4b5a | |||
|
2871fc0f53
|
|||
|
968689a512
|
|||
|
ab29f618f4
|
|||
| 94975a1b30 | |||
|
cd8880d9dc
|
|||
|
f59182b9c1
|
|||
|
941cb4a571
|
|||
|
f534898d8b
|
|||
| 18c7c54403 | |||
|
12a9d4674b
|
|||
|
1af8e068c5
|
|||
| 669b163814 | |||
| 46c7affd1f | |||
| 7ab107b689 | |||
| 5aee1a4100 | |||
|
1578fb9976
|
|||
| 8e64a7cf78 | |||
|
8b5bd66598
|
|||
| ac8552362c | |||
|
99c86c42c5
|
|||
|
d0267cb760
|
|||
| 25ddab9241 | |||
|
bf76ac55ee
|
|||
|
40e5c3609e
|
|||
|
1078c034ad
|
|||
|
bfa38ad7b2
|
|||
|
4f20cd0d0a
|
|||
|
e2ee33a1da
|
|||
|
8662a4c8c1
|
|||
|
dbc811b840
|
|||
|
884070a3cb
|
|||
|
3c350155de
|
|||
|
21c6ebc137
|
|||
|
0a1052fcb7
|
|||
|
f94227f9f3
|
|||
| 088961dfec | |||
|
31cf353d3a
|
|||
|
4eb40abc9c
|
|||
|
682c78c7c3
|
|||
|
f9726ad9be
|
|||
|
89188f5081
|
|||
| 6a6ff84ff2 | |||
|
b6949acc96
|
|||
|
814633034f
|
|||
| 260dedb6cf | |||
|
656c887811
|
|||
|
7e9af716ac
|
|||
|
58cc6811f9
|
|||
|
8ad85636d9
|
|||
|
35e2c8cd30
|
|||
| 4526c941b8 | |||
| 4f5ebd5330 | |||
|
d7e4c6f3ae
|
|||
|
14caefe2d1
|
|||
|
0110f27ada
|
|||
|
dc7cf107c2
|
|||
| 4fbfaadb44 | |||
|
a01cb9ae21
|
|||
|
698e4381c2
|
|||
|
8997349186
|
|||
|
92bfc33bf0
|
|||
|
c6eb21faad
|
|||
| 2d9bc90b16 | |||
|
a0c579e319
|
|||
|
f289ee9365
|
|||
| 46a7345ce9 | |||
|
e12d02a988
|
|||
| 5e8618f25a | |||
|
2bdf08a523
|
|||
|
9ddd36c414
|
|||
|
9372ea7343
|
|||
|
c62ce00184
|
|||
|
4d8cd740ba
|
|||
|
9858572a2f
|
|||
|
51edf55ae9
|
|||
| 75485ce8e9 | |||
|
fcbfcc4007
|
|||
|
cdcb7b3aef
|
|||
| bcf5172956 | |||
|
26c6c5a3b2
|
|||
|
4a65573934
|
|||
|
5e2d5c3b28
|
|||
|
2f70bae523
|
|||
|
40f3e8327a
|
|||
|
f3d6e29e4e
|
|||
| 8903ae2624 | |||
|
26e9073674
|
|||
| 73a89c2601 | |||
|
7d4dee17b7
|
|||
| 602ca6ee94 | |||
|
69fc1ca57e
|
|||
|
ee72a32c7e
|
|||
|
8a0d89ef60
|
|||
|
54af949c7d
|
|||
|
6dac732a7f
|
|||
|
e8c1a6066a
|
|||
| 44fadb12d6 | |||
|
533452469b
|
|||
| efe168b205 | |||
|
5b6d6bbd00
|
|||
|
458b585cdb
|
|||
|
f651289410
|
|||
|
7ca91cf882
|
|||
|
022094ce51
|
|||
| 2a2b0a90dc | |||
| e44535daee | |||
| c8ccb418b2 | |||
| a792d66c90 | |||
| f7e48ad3a6 | |||
|
8a7d809b92
|
|||
|
b8e75c7c4a
|
|||
|
7a58babd8e
|
|||
|
ba31ed559a
|
|||
|
9cebfd3f58
|
|||
|
7aadb5cb51
|
|||
|
69b99711e5
|
|||
|
e5fe843814
|
|||
|
d7fbda0855
|
|||
|
18df8fe449
|
25
.drone.yml
25
.drone.yml
@@ -1,6 +1,7 @@
|
|||||||
|
---
|
||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: CI build
|
aame: CI build
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: restore-cache
|
- name: restore-cache
|
||||||
@@ -12,12 +13,20 @@ steps:
|
|||||||
restore: true
|
restore: true
|
||||||
mount:
|
mount:
|
||||||
- vendor
|
- vendor
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
- name: rspec
|
- name: rspec
|
||||||
image: guildeducation/rails:2.7.1-12.19.0
|
image: guildeducation/rails:2.7.2-12.22.0
|
||||||
|
environment:
|
||||||
|
RAILS_ENV: test
|
||||||
commands:
|
commands:
|
||||||
- bundle install --jobs=3 --retry=3 --deployment
|
- bundle config set deployment 'true'
|
||||||
|
- bundle config set with 'development test'
|
||||||
|
- bundle install --jobs=3 --retry=3
|
||||||
- yarn install
|
- yarn install
|
||||||
- bundle exec rspec
|
- yarn run build:css
|
||||||
|
- bin/rspec
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
- master
|
- master
|
||||||
@@ -30,8 +39,16 @@ steps:
|
|||||||
rebuild: true
|
rebuild: true
|
||||||
mount:
|
mount:
|
||||||
- vendor
|
- vendor
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: cache
|
- name: cache
|
||||||
host:
|
host:
|
||||||
path: /var/lib/drone/tmp
|
path: /var/lib/drone/tmp
|
||||||
|
---
|
||||||
|
kind: signature
|
||||||
|
hmac: f9a8cf97f6596625721365f6238f6f298aa5a7a4de10c3fb61c57202ae9d1ee1
|
||||||
|
|
||||||
|
...
|
||||||
|
|||||||
11
.env.example
11
.env.example
@@ -1,8 +1,3 @@
|
|||||||
LDAP_HOST=192.168.33.10
|
EJABBERD_API_URL='https://xmpp.kosmos.org/api'
|
||||||
LDAP_PORT=389
|
LNDHUB_API_URL='http://localhost:3023'
|
||||||
#
|
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
||||||
# Production LDAP server:
|
|
||||||
#
|
|
||||||
# LDAP_HOST=ldap.kosmos.org
|
|
||||||
# LDAP_PORT=636
|
|
||||||
# LDAP_USE_TLS=true
|
|
||||||
|
|||||||
3
.env.production
Normal file
3
.env.production
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
EJABBERD_API_URL='https://xmpp.kosmos.org:5443/api'
|
||||||
|
LNDHUB_API_URL='http://10.1.1.163:3023'
|
||||||
|
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
||||||
3
.env.test
Normal file
3
.env.test
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
EJABBERD_API_URL='http://xmpp.example.com/api'
|
||||||
|
LNDHUB_API_URL='http://localhost:3023'
|
||||||
|
LNDHUB_PUBLIC_URL='https://lndhub.kosmos.org'
|
||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -39,3 +39,9 @@ yarn-debug.log*
|
|||||||
|
|
||||||
# Ignore local dotenv config file
|
# Ignore local dotenv config file
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
# Ignore redis dumps from sidekiq
|
||||||
|
dump.rdb
|
||||||
|
|
||||||
|
/app/assets/builds/*
|
||||||
|
!/app/assets/builds/.keep
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.6.1
|
2.7.2
|
||||||
|
|||||||
44
Gemfile
44
Gemfile
@@ -2,15 +2,19 @@ source 'https://rubygems.org'
|
|||||||
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||||
|
|
||||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||||
gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
|
gem 'rails', '~> 7.0.2'
|
||||||
# Use Puma as the app server
|
# Use Puma as the app server
|
||||||
gem 'puma', '~> 4.1'
|
gem 'puma', '~> 4.1'
|
||||||
# Use SCSS for stylesheets
|
# Separate dependency since Rails 7.0
|
||||||
gem 'sass-rails', '>= 6'
|
gem 'sprockets-rails'
|
||||||
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
|
# Allows custom JS build tasks to integrate with the asset pipeline
|
||||||
gem 'webpacker', '~> 4.0'
|
gem 'cssbundling-rails'
|
||||||
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
|
||||||
gem 'turbolinks', '~> 5'
|
gem "importmap-rails"
|
||||||
|
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
|
||||||
|
gem "turbo-rails"
|
||||||
|
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
|
||||||
|
gem "stimulus-rails"
|
||||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||||
gem 'jbuilder', '~> 2.7'
|
gem 'jbuilder', '~> 2.7'
|
||||||
# Use Redis adapter to run Action Cable in production
|
# Use Redis adapter to run Action Cable in production
|
||||||
@@ -18,39 +22,47 @@ gem 'jbuilder', '~> 2.7'
|
|||||||
# Use Active Model has_secure_password
|
# Use Active Model has_secure_password
|
||||||
# gem 'bcrypt', '~> 3.1.7'
|
# gem 'bcrypt', '~> 3.1.7'
|
||||||
|
|
||||||
# Reduces boot times through caching; required in config/boot.rb
|
# Configuration
|
||||||
gem 'bootsnap', '>= 1.4.2', require: false
|
gem 'dotenv-rails'
|
||||||
|
|
||||||
gem 'dotenv-rails', groups: [:development, :test]
|
# Security
|
||||||
|
gem 'lockbox'
|
||||||
|
|
||||||
|
# Authentication
|
||||||
gem 'warden'
|
gem 'warden'
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
gem 'devise_ldap_authenticatable'
|
gem 'devise_ldap_authenticatable'
|
||||||
gem 'net-ldap'
|
gem 'net-ldap'
|
||||||
|
|
||||||
|
# Utilities
|
||||||
|
gem "rqrcode", "~> 2.0"
|
||||||
|
|
||||||
|
# HTTP requests
|
||||||
|
gem 'faraday'
|
||||||
|
|
||||||
|
# Background/scheduled jobs
|
||||||
|
gem 'sidekiq'
|
||||||
|
gem 'sidekiq-scheduler'
|
||||||
|
|
||||||
group :development, :test do
|
group :development, :test do
|
||||||
# Use sqlite3 as the database for Active Record
|
# Use sqlite3 as the database for Active Record
|
||||||
gem 'sqlite3', '~> 1.4'
|
gem 'sqlite3', '~> 1.4'
|
||||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
gem 'rspec-rails'
|
||||||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
|
||||||
gem 'web-console', '>= 3.3.0'
|
gem 'web-console', '>= 3.3.0'
|
||||||
gem 'listen', '~> 3.2'
|
gem 'listen', '~> 3.2'
|
||||||
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
|
||||||
gem 'spring'
|
|
||||||
gem 'spring-watcher-listen', '~> 2.0.0'
|
|
||||||
gem 'letter_opener'
|
gem 'letter_opener'
|
||||||
gem 'letter_opener_web'
|
gem 'letter_opener_web'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'rspec-rails'
|
|
||||||
gem 'factory_bot_rails'
|
gem 'factory_bot_rails'
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
|
gem 'webmock'
|
||||||
end
|
end
|
||||||
|
|
||||||
group :production do
|
group :production do
|
||||||
|
|||||||
395
Gemfile.lock
395
Gemfile.lock
@@ -1,81 +1,100 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (6.0.3.4)
|
actioncable (7.0.2.2)
|
||||||
actionpack (= 6.0.3.4)
|
actionpack (= 7.0.2.2)
|
||||||
|
activesupport (= 7.0.2.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (>= 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailbox (6.0.3.4)
|
actionmailbox (7.0.2.2)
|
||||||
actionpack (= 6.0.3.4)
|
actionpack (= 7.0.2.2)
|
||||||
activejob (= 6.0.3.4)
|
activejob (= 7.0.2.2)
|
||||||
activerecord (= 6.0.3.4)
|
activerecord (= 7.0.2.2)
|
||||||
activestorage (= 6.0.3.4)
|
activestorage (= 7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
mail (>= 2.7.1)
|
mail (>= 2.7.1)
|
||||||
actionmailer (6.0.3.4)
|
net-imap
|
||||||
actionpack (= 6.0.3.4)
|
net-pop
|
||||||
actionview (= 6.0.3.4)
|
net-smtp
|
||||||
activejob (= 6.0.3.4)
|
actionmailer (7.0.2.2)
|
||||||
|
actionpack (= 7.0.2.2)
|
||||||
|
actionview (= 7.0.2.2)
|
||||||
|
activejob (= 7.0.2.2)
|
||||||
|
activesupport (= 7.0.2.2)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
|
net-imap
|
||||||
|
net-pop
|
||||||
|
net-smtp
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (6.0.3.4)
|
actionpack (7.0.2.2)
|
||||||
actionview (= 6.0.3.4)
|
actionview (= 7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
rack (~> 2.0, >= 2.0.8)
|
rack (~> 2.0, >= 2.2.0)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||||
actiontext (6.0.3.4)
|
actiontext (7.0.2.2)
|
||||||
actionpack (= 6.0.3.4)
|
actionpack (= 7.0.2.2)
|
||||||
activerecord (= 6.0.3.4)
|
activerecord (= 7.0.2.2)
|
||||||
activestorage (= 6.0.3.4)
|
activestorage (= 7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
|
globalid (>= 0.6.0)
|
||||||
nokogiri (>= 1.8.5)
|
nokogiri (>= 1.8.5)
|
||||||
actionview (6.0.3.4)
|
actionview (7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||||
activejob (6.0.3.4)
|
activejob (7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (6.0.3.4)
|
activemodel (7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
activerecord (6.0.3.4)
|
activerecord (7.0.2.2)
|
||||||
activemodel (= 6.0.3.4)
|
activemodel (= 7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
activestorage (6.0.3.4)
|
activestorage (7.0.2.2)
|
||||||
actionpack (= 6.0.3.4)
|
actionpack (= 7.0.2.2)
|
||||||
activejob (= 6.0.3.4)
|
activejob (= 7.0.2.2)
|
||||||
activerecord (= 6.0.3.4)
|
activerecord (= 7.0.2.2)
|
||||||
marcel (~> 0.3.1)
|
activesupport (= 7.0.2.2)
|
||||||
activesupport (6.0.3.4)
|
marcel (~> 1.0)
|
||||||
|
mini_mime (>= 1.1.0)
|
||||||
|
activesupport (7.0.2.2)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 1.6, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (>= 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 2.0)
|
||||||
zeitwerk (~> 2.2, >= 2.2.2)
|
addressable (2.8.0)
|
||||||
addressable (2.7.0)
|
|
||||||
public_suffix (>= 2.0.2, < 5.0)
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
bcrypt (3.1.16)
|
bcrypt (3.1.16)
|
||||||
bindex (0.8.1)
|
bindex (0.8.1)
|
||||||
bootsnap (1.5.0)
|
|
||||||
msgpack (~> 1.0)
|
|
||||||
builder (3.2.4)
|
builder (3.2.4)
|
||||||
byebug (11.1.3)
|
capybara (3.36.0)
|
||||||
capybara (3.33.0)
|
|
||||||
addressable
|
addressable
|
||||||
|
matrix
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
rack (>= 1.6.0)
|
rack (>= 1.6.0)
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
regexp_parser (~> 1.5)
|
regexp_parser (>= 1.5, < 3.0)
|
||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
concurrent-ruby (1.1.7)
|
chunky_png (1.4.0)
|
||||||
|
concurrent-ruby (1.1.9)
|
||||||
|
connection_pool (2.2.5)
|
||||||
|
crack (0.4.5)
|
||||||
|
rexml
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
database_cleaner (1.8.5)
|
cssbundling-rails (1.0.0)
|
||||||
devise (4.7.3)
|
railties (>= 6.0.0)
|
||||||
|
database_cleaner (2.0.1)
|
||||||
|
database_cleaner-active_record (~> 2.0.0)
|
||||||
|
database_cleaner-active_record (2.0.1)
|
||||||
|
activerecord (>= 5.a)
|
||||||
|
database_cleaner-core (~> 2.0.0)
|
||||||
|
database_cleaner-core (2.0.1)
|
||||||
|
devise (4.8.1)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
railties (>= 4.1.0)
|
railties (>= 4.1.0)
|
||||||
@@ -84,191 +103,237 @@ GEM
|
|||||||
devise_ldap_authenticatable (0.8.7)
|
devise_ldap_authenticatable (0.8.7)
|
||||||
devise (>= 3.4.1)
|
devise (>= 3.4.1)
|
||||||
net-ldap (>= 0.16.0)
|
net-ldap (>= 0.16.0)
|
||||||
diff-lcs (1.4.4)
|
diff-lcs (1.5.0)
|
||||||
dotenv (2.7.2)
|
digest (3.1.0)
|
||||||
dotenv-rails (2.7.2)
|
dotenv (2.7.6)
|
||||||
dotenv (= 2.7.2)
|
dotenv-rails (2.7.6)
|
||||||
railties (>= 3.2, < 6.1)
|
dotenv (= 2.7.6)
|
||||||
erubi (1.9.0)
|
railties (>= 3.2)
|
||||||
factory_bot (6.1.0)
|
e2mmap (0.1.0)
|
||||||
|
erubi (1.10.0)
|
||||||
|
et-orbi (1.2.6)
|
||||||
|
tzinfo
|
||||||
|
factory_bot (6.2.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
factory_bot_rails (6.1.0)
|
factory_bot_rails (6.2.0)
|
||||||
factory_bot (~> 6.1.0)
|
factory_bot (~> 6.2.0)
|
||||||
railties (>= 5.0.0)
|
railties (>= 5.0.0)
|
||||||
ffi (1.13.1)
|
faraday (2.2.0)
|
||||||
globalid (0.4.2)
|
faraday-net_http (~> 2.0)
|
||||||
activesupport (>= 4.2.0)
|
ruby2_keywords (>= 0.0.4)
|
||||||
i18n (1.8.5)
|
faraday-net_http (2.0.1)
|
||||||
|
ffi (1.15.5)
|
||||||
|
fugit (1.5.2)
|
||||||
|
et-orbi (~> 1.1, >= 1.1.8)
|
||||||
|
raabro (~> 1.4)
|
||||||
|
globalid (1.0.0)
|
||||||
|
activesupport (>= 5.0)
|
||||||
|
hashdiff (1.0.1)
|
||||||
|
i18n (1.9.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
jbuilder (2.10.1)
|
importmap-rails (1.0.2)
|
||||||
|
actionpack (>= 6.0.0)
|
||||||
|
railties (>= 6.0.0)
|
||||||
|
io-wait (0.2.1)
|
||||||
|
jbuilder (2.11.5)
|
||||||
|
actionview (>= 5.0.0)
|
||||||
activesupport (>= 5.0.0)
|
activesupport (>= 5.0.0)
|
||||||
launchy (2.4.3)
|
launchy (2.5.0)
|
||||||
addressable (~> 2.3)
|
addressable (~> 2.7)
|
||||||
letter_opener (1.7.0)
|
letter_opener (1.7.0)
|
||||||
launchy (~> 2.2)
|
launchy (~> 2.2)
|
||||||
letter_opener_web (1.3.4)
|
letter_opener_web (2.0.0)
|
||||||
actionmailer (>= 3.2)
|
actionmailer (>= 5.2)
|
||||||
letter_opener (~> 1.0)
|
letter_opener (~> 1.7)
|
||||||
railties (>= 3.2)
|
railties (>= 5.2)
|
||||||
listen (3.2.1)
|
rexml
|
||||||
|
listen (3.7.1)
|
||||||
rb-fsevent (~> 0.10, >= 0.10.3)
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
||||||
rb-inotify (~> 0.9, >= 0.9.10)
|
rb-inotify (~> 0.9, >= 0.9.10)
|
||||||
loofah (2.7.0)
|
lockbox (0.6.8)
|
||||||
|
loofah (2.14.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.7.1)
|
mail (2.7.1)
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
marcel (0.3.3)
|
marcel (1.0.2)
|
||||||
mimemagic (~> 0.3.2)
|
matrix (0.4.2)
|
||||||
method_source (1.0.0)
|
method_source (1.0.0)
|
||||||
mimemagic (0.3.5)
|
mini_mime (1.1.2)
|
||||||
mini_mime (1.0.2)
|
minitest (5.15.0)
|
||||||
mini_portile2 (2.4.0)
|
net-imap (0.2.3)
|
||||||
minitest (5.14.2)
|
digest
|
||||||
msgpack (1.3.3)
|
net-protocol
|
||||||
net-ldap (0.16.3)
|
strscan
|
||||||
nio4r (2.5.4)
|
net-ldap (0.17.0)
|
||||||
nokogiri (1.10.10)
|
net-pop (0.1.1)
|
||||||
mini_portile2 (~> 2.4.0)
|
digest
|
||||||
|
net-protocol
|
||||||
|
timeout
|
||||||
|
net-protocol (0.1.2)
|
||||||
|
io-wait
|
||||||
|
timeout
|
||||||
|
net-smtp (0.3.1)
|
||||||
|
digest
|
||||||
|
net-protocol
|
||||||
|
timeout
|
||||||
|
nio4r (2.5.8)
|
||||||
|
nokogiri (1.13.1-x86_64-linux)
|
||||||
|
racc (~> 1.4)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
pg (1.2.3)
|
pg (1.2.3)
|
||||||
public_suffix (4.0.6)
|
public_suffix (4.0.6)
|
||||||
puma (4.3.6)
|
puma (4.3.11)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
|
raabro (1.4.0)
|
||||||
|
racc (1.6.0)
|
||||||
rack (2.2.3)
|
rack (2.2.3)
|
||||||
rack-proxy (0.6.5)
|
|
||||||
rack
|
|
||||||
rack-test (1.1.0)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0, < 3)
|
rack (>= 1.0, < 3)
|
||||||
rails (6.0.3.4)
|
rails (7.0.2.2)
|
||||||
actioncable (= 6.0.3.4)
|
actioncable (= 7.0.2.2)
|
||||||
actionmailbox (= 6.0.3.4)
|
actionmailbox (= 7.0.2.2)
|
||||||
actionmailer (= 6.0.3.4)
|
actionmailer (= 7.0.2.2)
|
||||||
actionpack (= 6.0.3.4)
|
actionpack (= 7.0.2.2)
|
||||||
actiontext (= 6.0.3.4)
|
actiontext (= 7.0.2.2)
|
||||||
actionview (= 6.0.3.4)
|
actionview (= 7.0.2.2)
|
||||||
activejob (= 6.0.3.4)
|
activejob (= 7.0.2.2)
|
||||||
activemodel (= 6.0.3.4)
|
activemodel (= 7.0.2.2)
|
||||||
activerecord (= 6.0.3.4)
|
activerecord (= 7.0.2.2)
|
||||||
activestorage (= 6.0.3.4)
|
activestorage (= 7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
bundler (>= 1.3.0)
|
bundler (>= 1.15.0)
|
||||||
railties (= 6.0.3.4)
|
railties (= 7.0.2.2)
|
||||||
sprockets-rails (>= 2.0.0)
|
|
||||||
rails-dom-testing (2.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
nokogiri (>= 1.6)
|
nokogiri (>= 1.6)
|
||||||
rails-html-sanitizer (1.3.0)
|
rails-html-sanitizer (1.4.2)
|
||||||
loofah (~> 2.3)
|
loofah (~> 2.3)
|
||||||
railties (6.0.3.4)
|
railties (7.0.2.2)
|
||||||
actionpack (= 6.0.3.4)
|
actionpack (= 7.0.2.2)
|
||||||
activesupport (= 6.0.3.4)
|
activesupport (= 7.0.2.2)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 12.2)
|
||||||
thor (>= 0.20.3, < 2.0)
|
thor (~> 1.0)
|
||||||
rake (13.0.1)
|
zeitwerk (~> 2.5)
|
||||||
rb-fsevent (0.10.4)
|
rake (13.0.6)
|
||||||
|
rb-fsevent (0.11.1)
|
||||||
rb-inotify (0.10.1)
|
rb-inotify (0.10.1)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
regexp_parser (1.8.2)
|
redis (4.6.0)
|
||||||
|
regexp_parser (2.2.1)
|
||||||
responders (3.0.1)
|
responders (3.0.1)
|
||||||
actionpack (>= 5.0)
|
actionpack (>= 5.0)
|
||||||
railties (>= 5.0)
|
railties (>= 5.0)
|
||||||
rspec-core (3.10.0)
|
rexml (3.2.5)
|
||||||
rspec-support (~> 3.10.0)
|
rqrcode (2.1.1)
|
||||||
rspec-expectations (3.10.0)
|
chunky_png (~> 1.0)
|
||||||
|
rqrcode_core (~> 1.0)
|
||||||
|
rqrcode_core (1.2.0)
|
||||||
|
rspec-core (3.11.0)
|
||||||
|
rspec-support (~> 3.11.0)
|
||||||
|
rspec-expectations (3.11.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.10.0)
|
rspec-support (~> 3.11.0)
|
||||||
rspec-mocks (3.10.0)
|
rspec-mocks (3.11.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.10.0)
|
rspec-support (~> 3.11.0)
|
||||||
rspec-rails (4.0.1)
|
rspec-rails (5.1.0)
|
||||||
actionpack (>= 4.2)
|
actionpack (>= 5.2)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 5.2)
|
||||||
railties (>= 4.2)
|
railties (>= 5.2)
|
||||||
rspec-core (~> 3.9)
|
rspec-core (~> 3.10)
|
||||||
rspec-expectations (~> 3.9)
|
rspec-expectations (~> 3.10)
|
||||||
rspec-mocks (~> 3.9)
|
rspec-mocks (~> 3.10)
|
||||||
rspec-support (~> 3.9)
|
rspec-support (~> 3.10)
|
||||||
rspec-support (3.10.0)
|
rspec-support (3.11.0)
|
||||||
sass-rails (6.0.0)
|
ruby2_keywords (0.0.5)
|
||||||
sassc-rails (~> 2.1, >= 2.1.1)
|
rufus-scheduler (3.8.1)
|
||||||
sassc (2.4.0)
|
fugit (~> 1.1, >= 1.1.6)
|
||||||
ffi (~> 1.9)
|
sidekiq (6.4.1)
|
||||||
sassc-rails (2.1.2)
|
connection_pool (>= 2.2.2)
|
||||||
railties (>= 4.0.0)
|
rack (~> 2.0)
|
||||||
sassc (>= 2.0)
|
redis (>= 4.2.0)
|
||||||
sprockets (> 3.0)
|
sidekiq-scheduler (3.1.1)
|
||||||
sprockets-rails
|
e2mmap
|
||||||
tilt
|
redis (>= 3, < 5)
|
||||||
spring (2.1.1)
|
rufus-scheduler (~> 3.2)
|
||||||
spring-watcher-listen (2.0.1)
|
sidekiq (>= 3)
|
||||||
listen (>= 2.7, < 4.0)
|
thwait
|
||||||
spring (>= 1.2, < 3.0)
|
tilt (>= 1.4.0)
|
||||||
sprockets (4.0.2)
|
sprockets (4.0.2)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
sprockets-rails (3.2.2)
|
sprockets-rails (3.4.2)
|
||||||
actionpack (>= 4.0)
|
actionpack (>= 5.2)
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 5.2)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sqlite3 (1.4.2)
|
sqlite3 (1.4.2)
|
||||||
thor (1.0.1)
|
stimulus-rails (1.0.2)
|
||||||
thread_safe (0.3.6)
|
railties (>= 6.0.0)
|
||||||
|
strscan (3.0.1)
|
||||||
|
thor (1.2.1)
|
||||||
|
thwait (0.2.0)
|
||||||
|
e2mmap
|
||||||
tilt (2.0.10)
|
tilt (2.0.10)
|
||||||
turbolinks (5.2.1)
|
timeout (0.2.0)
|
||||||
turbolinks-source (~> 5.2)
|
turbo-rails (1.0.1)
|
||||||
turbolinks-source (5.2.0)
|
actionpack (>= 6.0.0)
|
||||||
tzinfo (1.2.7)
|
railties (>= 6.0.0)
|
||||||
thread_safe (~> 0.1)
|
tzinfo (2.0.4)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
warden (1.2.9)
|
warden (1.2.9)
|
||||||
rack (>= 2.0.9)
|
rack (>= 2.0.9)
|
||||||
web-console (4.1.0)
|
web-console (4.2.0)
|
||||||
actionview (>= 6.0.0)
|
actionview (>= 6.0.0)
|
||||||
activemodel (>= 6.0.0)
|
activemodel (>= 6.0.0)
|
||||||
bindex (>= 0.4.0)
|
bindex (>= 0.4.0)
|
||||||
railties (>= 6.0.0)
|
railties (>= 6.0.0)
|
||||||
webpacker (4.3.0)
|
webmock (3.14.0)
|
||||||
activesupport (>= 4.2)
|
addressable (>= 2.8.0)
|
||||||
rack-proxy (>= 0.6.1)
|
crack (>= 0.3.2)
|
||||||
railties (>= 4.2)
|
hashdiff (>= 0.4.0, < 2.0.0)
|
||||||
websocket-driver (0.7.3)
|
websocket-driver (0.7.5)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.5)
|
websocket-extensions (0.1.5)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
zeitwerk (2.4.1)
|
zeitwerk (2.5.4)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
x86_64-linux
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bootsnap (>= 1.4.2)
|
|
||||||
byebug
|
|
||||||
capybara
|
capybara
|
||||||
|
cssbundling-rails
|
||||||
database_cleaner
|
database_cleaner
|
||||||
devise
|
devise
|
||||||
devise_ldap_authenticatable
|
devise_ldap_authenticatable
|
||||||
dotenv-rails
|
dotenv-rails
|
||||||
factory_bot_rails
|
factory_bot_rails
|
||||||
|
faraday
|
||||||
|
importmap-rails
|
||||||
jbuilder (~> 2.7)
|
jbuilder (~> 2.7)
|
||||||
letter_opener
|
letter_opener
|
||||||
letter_opener_web
|
letter_opener_web
|
||||||
listen (~> 3.2)
|
listen (~> 3.2)
|
||||||
|
lockbox
|
||||||
net-ldap
|
net-ldap
|
||||||
pg (~> 1.2.3)
|
pg (~> 1.2.3)
|
||||||
puma (~> 4.1)
|
puma (~> 4.1)
|
||||||
rails (~> 6.0.3, >= 6.0.3.4)
|
rails (~> 7.0.2)
|
||||||
|
rqrcode (~> 2.0)
|
||||||
rspec-rails
|
rspec-rails
|
||||||
sass-rails (>= 6)
|
sidekiq
|
||||||
spring
|
sidekiq-scheduler
|
||||||
spring-watcher-listen (~> 2.0.0)
|
sprockets-rails
|
||||||
sqlite3 (~> 1.4)
|
sqlite3 (~> 1.4)
|
||||||
turbolinks (~> 5)
|
stimulus-rails
|
||||||
|
turbo-rails
|
||||||
tzinfo-data
|
tzinfo-data
|
||||||
warden
|
warden
|
||||||
web-console (>= 3.3.0)
|
web-console (>= 3.3.0)
|
||||||
webpacker (~> 4.0)
|
webmock
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.0.2
|
2.3.5
|
||||||
|
|||||||
2
Procfile.dev
Normal file
2
Procfile.dev
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
web: bin/rails server -p 3000
|
||||||
|
css: yarn build:css --watch
|
||||||
37
README.md
37
README.md
@@ -1,25 +1,10 @@
|
|||||||
|
[](https://drone.kosmos.org/kosmos/akkounts)
|
||||||
|
|
||||||
# Akkounts
|
# Akkounts
|
||||||
|
|
||||||
This app allows Kosmos/LDAP users to manage their accounts, including
|
This app allows Kosmos/LDAP users to manage their accounts, including
|
||||||
credentials, invites, donations, etc..
|
credentials, invites, donations, etc..
|
||||||
|
|
||||||
## Features
|
|
||||||
|
|
||||||
* [x] Log in with existing LDAP account
|
|
||||||
* [x] Reset account password by providing both username and email address
|
|
||||||
* [x] Reset account password when logged in, via reset email
|
|
||||||
* [x] Log in with admin permissions
|
|
||||||
* [x] View LDAP users as admin
|
|
||||||
* [ ] List my donations
|
|
||||||
* [ ] Invite new users from your account
|
|
||||||
* [ ] Sign up for a new account via invite
|
|
||||||
* [ ] Sign up for a new account by donating upfront
|
|
||||||
* [ ] Sign up for a new account via proving contributions (via cryptographic signature)
|
|
||||||
* [ ] ...
|
|
||||||
|
|
||||||
_Planned features are not at all a complete or static list, of course.
|
|
||||||
Suggestions and pull requests welcome!_
|
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Rails app
|
### Rails app
|
||||||
@@ -38,6 +23,10 @@ Running the dev server:
|
|||||||
|
|
||||||
bundle exec rails server
|
bundle exec rails server
|
||||||
|
|
||||||
|
Running the background workers (requires Redis):
|
||||||
|
|
||||||
|
bundle exec sidekiq -C config/sidekiq.yml
|
||||||
|
|
||||||
Running all specs:
|
Running all specs:
|
||||||
|
|
||||||
bundle exec rspec
|
bundle exec rspec
|
||||||
@@ -52,6 +41,15 @@ manual LDIF imports etc. (or provide a staging instance)
|
|||||||
* [Ruby on Rails](https://guides.rubyonrails.org/)
|
* [Ruby on Rails](https://guides.rubyonrails.org/)
|
||||||
* [Sass](https://sass-lang.com/documentation)
|
* [Sass](https://sass-lang.com/documentation)
|
||||||
|
|
||||||
|
### Front-end
|
||||||
|
|
||||||
|
* [Tailwind CSS](https://tailwindcss.com/)
|
||||||
|
|
||||||
|
**Caveat:** if you only add Tailwind classes/directives to templates or
|
||||||
|
helpers, but there's no change in the stylesheet files, then the new directives
|
||||||
|
won't be compiled in production. In this case, count up the version comment at
|
||||||
|
the top of `app/javascript/stylesheets/application.scss` to trigger compilation.
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
* [RSpec](https://rspec.info/documentation/)
|
* [RSpec](https://rspec.info/documentation/)
|
||||||
@@ -62,6 +60,11 @@ manual LDIF imports etc. (or provide a staging instance)
|
|||||||
* [devise_ldap_authenticatable](https://github.com/cschiewek/devise_ldap_authenticatable)
|
* [devise_ldap_authenticatable](https://github.com/cschiewek/devise_ldap_authenticatable)
|
||||||
* [net/ldap](https://www.rubydoc.info/gems/net-ldap/Net/LDAP)
|
* [net/ldap](https://www.rubydoc.info/gems/net-ldap/Net/LDAP)
|
||||||
|
|
||||||
|
### Asynchronous jobs/workers
|
||||||
|
|
||||||
|
* [Sidekiq](https://github.com/mperham/sidekiq/wiki/)
|
||||||
|
* [ActiveJob](https://github.com/mperham/sidekiq/wiki/Active-Job)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0/)
|
[GNU Affero General Public License v3.0](https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
|
|||||||
0
app/assets/builds/.keep
Normal file
0
app/assets/builds/.keep
Normal file
@@ -1,2 +1,3 @@
|
|||||||
//= link_tree ../images
|
//= link_tree ../images
|
||||||
//= link_directory ../stylesheets .css
|
//= link_tree ../../javascript .js
|
||||||
|
//= link_tree ../builds
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
html, body, h1, h2, h3, h4, h5, h6, p, pre, a, dl, dt, dd, ol, ul, li {
|
|
||||||
font-size: 100%;
|
|
||||||
vertical-align: baseline;
|
|
||||||
background: transparent;
|
|
||||||
box-sizing: border-box;
|
|
||||||
overflow: visible;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/*
|
|
||||||
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
||||||
* listed below.
|
|
||||||
*
|
|
||||||
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
|
|
||||||
* vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
||||||
*
|
|
||||||
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
||||||
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
||||||
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
||||||
* It is generally better to create a new file per style scope.
|
|
||||||
*
|
|
||||||
*= require_tree .
|
|
||||||
*= require_self
|
|
||||||
*/
|
|
||||||
8
app/assets/stylesheets/application.tailwind.css
Normal file
8
app/assets/stylesheets/application.tailwind.css
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
@import "tailwindcss/base";
|
||||||
|
@import "tailwindcss/components";
|
||||||
|
@import "tailwindcss/utilities";
|
||||||
|
|
||||||
|
@import "components/base";
|
||||||
|
@import "components/buttons";
|
||||||
|
@import "components/forms";
|
||||||
|
@import "components/links";
|
||||||
21
app/assets/stylesheets/components/base.css
Normal file
21
app/assets/stylesheets/components/base.css
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
@layer base {
|
||||||
|
body {
|
||||||
|
@apply leading-none
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3 {
|
||||||
|
@apply font-light;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
@apply text-3xl uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
@apply text-2xl mb-8;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
@apply text-xl mb-6;
|
||||||
|
}
|
||||||
|
}
|
||||||
31
app/assets/stylesheets/components/buttons.css
Normal file
31
app/assets/stylesheets/components/buttons.css
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
@layer components {
|
||||||
|
.btn {
|
||||||
|
@apply font-semibold rounded-md leading-none cursor-pointer
|
||||||
|
transition-colors duration-75 focus:outline-none focus:ring-4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-md {
|
||||||
|
@apply btn;
|
||||||
|
@apply py-2.5 px-5 shadow-md;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-sm {
|
||||||
|
@apply btn;
|
||||||
|
@apply py-1 px-2 text-sm shadow-sm;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-gray {
|
||||||
|
@apply bg-gray-100 hover:bg-gray-200
|
||||||
|
focus:ring-gray-300 focus:ring-opacity-75;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-blue {
|
||||||
|
@apply bg-blue-500 hover:bg-blue-600 text-white
|
||||||
|
focus:ring-blue-400 focus:ring-opacity-75;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-red {
|
||||||
|
@apply bg-red-600 hover:bg-red-700 text-white
|
||||||
|
focus:ring-red-500 focus:ring-opacity-75;
|
||||||
|
}
|
||||||
|
}
|
||||||
15
app/assets/stylesheets/components/forms.css
Normal file
15
app/assets/stylesheets/components/forms.css
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
@layer components {
|
||||||
|
input[type=text], input[type=email], input[type=password],
|
||||||
|
input[type=number], select {
|
||||||
|
@apply mt-1 rounded-md bg-gray-100 focus:bg-white
|
||||||
|
border-transparent focus:border-gray-500 focus:ring-0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field_with_errors {
|
||||||
|
@apply inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-msg {
|
||||||
|
@apply text-red-700;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
app/assets/stylesheets/components/links.css
Normal file
14
app/assets/stylesheets/components/links.css
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
@layer components {
|
||||||
|
.ks-text-link {
|
||||||
|
@apply text-blue-600;
|
||||||
|
&:hover { @apply underline; }
|
||||||
|
&:visited { @apply text-indigo-600; }
|
||||||
|
&:active { @apply text-red-600; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.devise-links {
|
||||||
|
a {
|
||||||
|
@apply ks-text-link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
@font-face {
|
|
||||||
font-family: 'Raleway';
|
|
||||||
src: url('/fonts/raleway-light.woff') format('woff2');
|
|
||||||
font-weight: 300;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
font-family: "Open Sans", Helvetica, Arial, sans-serif;
|
|
||||||
font-weight: 400;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1, h2, h3 {
|
|
||||||
font-family: Raleway, inherit;
|
|
||||||
font-weight: 300;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
text-transform: uppercase;
|
|
||||||
}
|
|
||||||
2
app/assets/stylesheets/legacy.sass.scss
Normal file
2
app/assets/stylesheets/legacy.sass.scss
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
@import "legacy/layout";
|
||||||
|
@import "legacy/main_nav";
|
||||||
@@ -1,11 +1,6 @@
|
|||||||
|
@import "variables";
|
||||||
@import "mediaqueries";
|
@import "mediaqueries";
|
||||||
|
|
||||||
$content-width: 800px;
|
|
||||||
$content-max-width: 100%;
|
|
||||||
|
|
||||||
body {
|
|
||||||
}
|
|
||||||
|
|
||||||
#wrapper {
|
#wrapper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -14,50 +9,39 @@ body {
|
|||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 4rem 0;
|
padding: 4rem 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: #0d4f99;
|
background: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(13,79,153,0.8) 100%),
|
||||||
background: linear-gradient(35deg, #8955a0 0, #0d4f99 100%);
|
url('/img/bg-1.jpg');
|
||||||
|
background-size: cover;
|
||||||
|
|
||||||
@include media-max(small) {
|
@include media-max(small) {
|
||||||
padding: 3rem 0;
|
padding: 3rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 1.8rem;
|
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
|
||||||
span.project-name {
|
span.project-name {
|
||||||
display: none;
|
display: none;
|
||||||
// font-size: .5em;
|
|
||||||
// text-transform: none;
|
|
||||||
// vertical-align: super;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
span.beta {
|
span.icon {
|
||||||
font-size: .5em;
|
svg {
|
||||||
font-style: italic;
|
display: inline-block;
|
||||||
text-transform: none;
|
height: 1.875rem;
|
||||||
vertical-align: super;
|
vertical-align: top;
|
||||||
}
|
width: auto;
|
||||||
|
}
|
||||||
|
|
||||||
span.bolt {
|
margin-right: 0.5rem;
|
||||||
color: #ffd000;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.current-user {
|
p.current-user {
|
||||||
margin-top: 2rem;
|
|
||||||
color: rgba(255,255,255,0.6);
|
color: rgba(255,255,255,0.6);
|
||||||
|
|
||||||
@include media-max(small) {
|
@include media-max(small) {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
strong {
|
|
||||||
font-weight: 400;
|
|
||||||
color: #fff;
|
|
||||||
// color: #ffd000;
|
|
||||||
// color: #ccff40;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
@@ -71,24 +55,48 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body#admin-panel {
|
||||||
|
#wrapper {
|
||||||
|
> header {
|
||||||
|
background: $color-red-bright;
|
||||||
|
background: linear-gradient(35deg, rgba(255,0,255,0.2) 0, rgba(153,12,14,0.9) 100%),
|
||||||
|
url('/img/bg-1.jpg');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-nav {
|
||||||
|
ul {
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
|
||||||
|
li {
|
||||||
|
a {
|
||||||
|
&.active {
|
||||||
|
border-bottom: 2px solid $color-red-bright;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.flash-msg {
|
.flash-msg {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 2rem 0;
|
padding: 2rem 0;
|
||||||
|
|
||||||
&.notice {
|
&.notice {
|
||||||
background: #efffc4;
|
background: $background-color-notice;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.alert {
|
&.alert {
|
||||||
background: #fff4c2;
|
background: $background-color-alert;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
width: $content-width;
|
width: $content-width;
|
||||||
max-width: $content-max-width;
|
max-width: $content-max-width;
|
||||||
margin: 4rem auto;
|
margin: 4rem auto 6rem auto;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
||||||
@include media-max(medium) {
|
@include media-max(medium) {
|
||||||
@@ -99,18 +107,6 @@ main {
|
|||||||
margin: 3rem auto;
|
margin: 3rem auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2, h3 {
|
|
||||||
margin-bottom: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
p {
|
||||||
line-height: 1.5rem;
|
line-height: 1.5rem;
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
@@ -128,19 +124,36 @@ main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
th, td {
|
section {
|
||||||
line-height: 1.5rem;
|
margin-bottom: 3rem;
|
||||||
padding-right: 1rem;
|
|
||||||
|
h2 {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
section {
|
table {
|
||||||
border-bottom: 1px dotted #ccc;
|
width: 100%;
|
||||||
padding-bottom: 4rem;
|
|
||||||
margin-bottom: 4rem;
|
|
||||||
|
|
||||||
@include media-max(small) {
|
th, td {
|
||||||
padding-bottom: 3rem;
|
&.hide-small {
|
||||||
margin-bottom: 3rem;
|
@include media-max(small) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
color: $text-color-discreet;
|
||||||
|
font-weight: normal;
|
||||||
|
text-transform: uppercase;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
padding-bottom: 0.825rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
padding-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -156,18 +169,5 @@ main {
|
|||||||
@include media-max(small) {
|
@include media-max(small) {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
margin-top: 3rem;
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid-item {
|
|
||||||
p {
|
|
||||||
color: #888;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
54
app/assets/stylesheets/legacy/_main_nav.scss
Normal file
54
app/assets/stylesheets/legacy/_main_nav.scss
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
@import "variables";
|
||||||
|
@import "mediaqueries";
|
||||||
|
|
||||||
|
#main-nav {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #efefef;
|
||||||
|
|
||||||
|
.wrapper {
|
||||||
|
width: $content-width;
|
||||||
|
max-width: $content-max-width;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
@include media-max(large) {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
@include media-min(large) {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include media-max(large) {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 1.5rem 2rem;
|
||||||
|
text-decoration: none;
|
||||||
|
color: $text-color-discreet;
|
||||||
|
|
||||||
|
@include media-max(large) {
|
||||||
|
display: block;
|
||||||
|
text-align: center;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include media-max(small) {
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
color: $text-color-body;
|
||||||
|
border-bottom: 2px solid #4ea2df;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
app/assets/stylesheets/legacy/_variables.scss
Normal file
13
app/assets/stylesheets/legacy/_variables.scss
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
$content-width: 800px;
|
||||||
|
$content-max-width: 100%;
|
||||||
|
|
||||||
|
$text-color-body: #222;
|
||||||
|
$text-color-discreet: #888;
|
||||||
|
|
||||||
|
$background-color-notice: #efffc4;
|
||||||
|
$background-color-alert: #fff4c2;
|
||||||
|
|
||||||
|
$color-blue: #0d4f99;
|
||||||
|
$color-purple: #8955a0;
|
||||||
|
$color-red-bright: #c00;
|
||||||
|
$color-red-dark: #990c0e;
|
||||||
@@ -3,4 +3,6 @@ class Admin::BaseController < ApplicationController
|
|||||||
before_action :authenticate_user!
|
before_action :authenticate_user!
|
||||||
before_action :authorize_admin
|
before_action :authorize_admin
|
||||||
|
|
||||||
|
layout "admin"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
class Admin::DashboardController < Admin::BaseController
|
class Admin::DashboardController < Admin::BaseController
|
||||||
def index
|
def index
|
||||||
|
@current_section = :dashboard
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
79
app/controllers/admin/donations_controller.rb
Normal file
79
app/controllers/admin/donations_controller.rb
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
class Admin::DonationsController < Admin::BaseController
|
||||||
|
before_action :set_donation, only: [:show, :edit, :update, :destroy]
|
||||||
|
before_action :set_current_section, only: [:index, :show, :new, :edit]
|
||||||
|
|
||||||
|
# GET /donations
|
||||||
|
# GET /donations.json
|
||||||
|
def index
|
||||||
|
@donations = Donation.all
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /donations/1
|
||||||
|
# GET /donations/1.json
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /donations/new
|
||||||
|
def new
|
||||||
|
@donation = Donation.new
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /donations/1/edit
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /donations
|
||||||
|
# POST /donations.json
|
||||||
|
def create
|
||||||
|
@donation = Donation.new(donation_params)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @donation.save
|
||||||
|
format.html { redirect_to admin_donation_url(@donation), notice: 'Donation was successfully created.' }
|
||||||
|
format.json { render :show, status: :created, location: @donation }
|
||||||
|
else
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: @donation.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# PATCH/PUT /donations/1
|
||||||
|
# PATCH/PUT /donations/1.json
|
||||||
|
def update
|
||||||
|
respond_to do |format|
|
||||||
|
if @donation.update(donation_params)
|
||||||
|
format.html { redirect_to admin_donation_url(@donation), notice: 'Donation was successfully updated.' }
|
||||||
|
format.json { render :show, status: :ok, location: @donation }
|
||||||
|
else
|
||||||
|
format.html { render :edit }
|
||||||
|
format.json { render json: @donation.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /donations/1
|
||||||
|
# DELETE /donations/1.json
|
||||||
|
def destroy
|
||||||
|
@donation.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to admin_donations_url, notice: 'Donation was successfully destroyed.' }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
|
def set_donation
|
||||||
|
@donation = Donation.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
# Only allow a list of trusted parameters through.
|
||||||
|
def donation_params
|
||||||
|
params.require(:donation).permit(:user_id, :amount_sats, :amount_eur, :amount_usd, :public_name, :paid_at)
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_current_section
|
||||||
|
@current_section = :donations
|
||||||
|
end
|
||||||
|
end
|
||||||
8
app/controllers/admin/invitations_controller.rb
Normal file
8
app/controllers/admin/invitations_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class Admin::InvitationsController < Admin::BaseController
|
||||||
|
def index
|
||||||
|
@current_section = :invitations
|
||||||
|
@invitations_unused_count = Invitation.unused.count
|
||||||
|
@users_with_referrals_count = Invitation.used.distinct.count(:user_id)
|
||||||
|
@invitations_used = Invitation.used.order('used_at desc')
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
class Admin::LdapUsersController < Admin::BaseController
|
class Admin::LdapUsersController < Admin::BaseController
|
||||||
|
before_action :set_current_section
|
||||||
|
|
||||||
def index
|
def index
|
||||||
attributes = %w{dn cn uid mail admin}
|
attributes = %w{dn cn uid mail admin}
|
||||||
filter = Net::LDAP::Filter.eq("uid", "*")
|
filter = Net::LDAP::Filter.eq("uid", "*")
|
||||||
if params[:ou]
|
|
||||||
treebase = "ou=#{params[:ou]},cn=users,dc=kosmos,dc=org"
|
@ou = params[:ou] || "kosmos.org"
|
||||||
else
|
treebase = "ou=#{@ou},cn=users,dc=kosmos,dc=org"
|
||||||
treebase = "ou=kosmos.org,cn=users,dc=kosmos,dc=org"
|
|
||||||
end
|
|
||||||
|
|
||||||
entries = ldap_client.search(base: treebase, filter: filter, attributes: attributes)
|
entries = ldap_client.search(base: treebase, filter: filter, attributes: attributes)
|
||||||
entries.sort_by! { |e| e.cn[0] }
|
entries.sort_by! { |e| e.cn[0] }
|
||||||
@@ -38,4 +38,8 @@ class Admin::LdapUsersController < Admin::BaseController
|
|||||||
def ldap_config
|
def ldap_config
|
||||||
ldap_config ||= YAML.load(ERB.new(File.read("#{Rails.root}/config/ldap.yml")).result)[Rails.env]
|
ldap_config ||= YAML.load(ERB.new(File.read("#{Rails.root}/config/ldap.yml")).result)[Rails.env]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_current_section
|
||||||
|
@current_section = :ldap_users
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ class ApplicationController < ActionController::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def require_user_signed_out
|
||||||
|
if user_signed_in?
|
||||||
|
redirect_to root_path and return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def authorize_admin
|
def authorize_admin
|
||||||
http_status :forbidden unless current_user.is_admin?
|
http_status :forbidden unless current_user.is_admin?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,5 +2,6 @@ class DashboardController < ApplicationController
|
|||||||
before_action :require_user_signed_in
|
before_action :require_user_signed_in
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@current_section = :dashboard
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
10
app/controllers/donations_controller.rb
Normal file
10
app/controllers/donations_controller.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class DonationsController < ApplicationController
|
||||||
|
before_action :require_user_signed_in
|
||||||
|
|
||||||
|
# GET /donations
|
||||||
|
# GET /donations.json
|
||||||
|
def index
|
||||||
|
@donations = current_user.donations.completed
|
||||||
|
@current_section = :contributions
|
||||||
|
end
|
||||||
|
end
|
||||||
50
app/controllers/invitations_controller.rb
Normal file
50
app/controllers/invitations_controller.rb
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
class InvitationsController < ApplicationController
|
||||||
|
before_action :require_user_signed_in, except: ["show"]
|
||||||
|
before_action :require_user_signed_out, only: ["show"]
|
||||||
|
|
||||||
|
layout "signup", only: ["show"]
|
||||||
|
|
||||||
|
# GET /invitations
|
||||||
|
def index
|
||||||
|
@invitations_unused = current_user.invitations.unused
|
||||||
|
@invitations_used = current_user.invitations.used
|
||||||
|
@current_section = :invitations
|
||||||
|
end
|
||||||
|
|
||||||
|
# GET /invitations/a-random-invitation-token
|
||||||
|
def show
|
||||||
|
token = session[:invitation_token] = params[:id]
|
||||||
|
|
||||||
|
if Invitation.where(token: token, used_at: nil).exists?
|
||||||
|
redirect_to signup_path and return
|
||||||
|
else
|
||||||
|
flash.now[:alert] = "This invitation either doesn't exist or has already been used."
|
||||||
|
http_status :unauthorized
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# POST /invitations
|
||||||
|
def create
|
||||||
|
@invitation = Invitation.new(user: current_user)
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
if @invitation.save
|
||||||
|
format.html { redirect_to @invitation, notice: 'Invitation was successfully created.' }
|
||||||
|
format.json { render :show, status: :created, location: @invitation }
|
||||||
|
else
|
||||||
|
format.html { render :new }
|
||||||
|
format.json { render json: @invitation.errors, status: :unprocessable_entity }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# DELETE /invitations/1
|
||||||
|
def destroy
|
||||||
|
@invitation = current_user.invitations.find(params[:id])
|
||||||
|
@invitation.destroy
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to invitations_url }
|
||||||
|
format.json { head :no_content }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
60
app/controllers/lnurlpay_controller.rb
Normal file
60
app/controllers/lnurlpay_controller.rb
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
class LnurlpayController < ApplicationController
|
||||||
|
before_action :find_user_by_address
|
||||||
|
|
||||||
|
MIN_SATS = 100
|
||||||
|
MAX_SATS = 1_000_000
|
||||||
|
|
||||||
|
def index
|
||||||
|
render json: {
|
||||||
|
status: "OK",
|
||||||
|
callback: "https://accounts.kosmos.org/lnurlpay/#{@user.address}/invoice",
|
||||||
|
tag: "payRequest",
|
||||||
|
maxSendable: MAX_SATS * 1000, # msat
|
||||||
|
minSendable: MIN_SATS * 1000, # msat
|
||||||
|
metadata: metadata(@user.address),
|
||||||
|
commentAllowed: 0
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def invoice
|
||||||
|
amount = params[:amount].to_i / 1000 # msats
|
||||||
|
address = params[:address]
|
||||||
|
|
||||||
|
if !valid_amount?(amount)
|
||||||
|
render json: { status: "ERROR", reason: "Invalid amount" }
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
payment_request = @user.ln_create_invoice({
|
||||||
|
amount: amount, # we create invoices in sats
|
||||||
|
description_hash: Digest::SHA2.hexdigest(metadata(address))
|
||||||
|
})
|
||||||
|
|
||||||
|
render json: {
|
||||||
|
status: "OK",
|
||||||
|
successAction: {
|
||||||
|
tag: "message",
|
||||||
|
message: "Sats received. Thank you!"
|
||||||
|
},
|
||||||
|
routes: [],
|
||||||
|
pr: payment_request
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def find_user_by_address
|
||||||
|
address = params[:address].split("@")
|
||||||
|
@user = User.where(cn: address.first, ou: address.last).first
|
||||||
|
http_status :not_found if @user.nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
def metadata(address)
|
||||||
|
"[[\"text/identifier\", \"#{address}\"], [\"text/plain\", \"Send sats, receive thanks.\"]]"
|
||||||
|
end
|
||||||
|
|
||||||
|
def valid_amount?(amount_in_sats)
|
||||||
|
amount_in_sats <= MAX_SATS && amount_in_sats >= MIN_SATS
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
7
app/controllers/security_controller.rb
Normal file
7
app/controllers/security_controller.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
class SecurityController < ApplicationController
|
||||||
|
before_action :require_user_signed_in
|
||||||
|
|
||||||
|
def index
|
||||||
|
@current_section = :security
|
||||||
|
end
|
||||||
|
end
|
||||||
108
app/controllers/signup_controller.rb
Normal file
108
app/controllers/signup_controller.rb
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
class SignupController < ApplicationController
|
||||||
|
before_action :require_user_signed_out
|
||||||
|
before_action :require_invitation
|
||||||
|
before_action :set_invitation
|
||||||
|
before_action :set_new_user, only: ["steps", "validate"]
|
||||||
|
|
||||||
|
layout "signup"
|
||||||
|
|
||||||
|
def index
|
||||||
|
@invited_by_name = @invitation.user.address
|
||||||
|
end
|
||||||
|
|
||||||
|
def steps
|
||||||
|
@step = params[:step].to_i
|
||||||
|
http_status :not_found unless [1,2,3].include?(@step)
|
||||||
|
@validation_error = session[:validation_error]
|
||||||
|
end
|
||||||
|
|
||||||
|
def validate
|
||||||
|
session[:validation_error] = nil
|
||||||
|
|
||||||
|
case user_params.keys.first
|
||||||
|
when "cn"
|
||||||
|
@user.cn = user_params[:cn]
|
||||||
|
@user.valid?
|
||||||
|
session[:new_user] = @user
|
||||||
|
|
||||||
|
if @user.errors[:cn].present?
|
||||||
|
session[:validation_error] = @user.errors[:cn].first # Store user including validation errors
|
||||||
|
redirect_to signup_steps_path(1) and return
|
||||||
|
else
|
||||||
|
redirect_to signup_steps_path(2) and return
|
||||||
|
end
|
||||||
|
when "email"
|
||||||
|
@user.email = user_params[:email]
|
||||||
|
@user.valid?
|
||||||
|
session[:new_user] = @user
|
||||||
|
|
||||||
|
if @user.errors[:email].present?
|
||||||
|
session[:validation_error] = @user.errors[:email].first # Store user including validation errors
|
||||||
|
redirect_to signup_steps_path(2) and return
|
||||||
|
else
|
||||||
|
redirect_to signup_steps_path(3) and return
|
||||||
|
end
|
||||||
|
when "password"
|
||||||
|
@user.password = user_params[:password]
|
||||||
|
@user.password_confirmation = user_params[:password]
|
||||||
|
@user.valid?
|
||||||
|
session[:new_user] = @user
|
||||||
|
|
||||||
|
if @user.errors[:password].present?
|
||||||
|
session[:validation_error] = @user.errors[:password].first # Store user including validation errors
|
||||||
|
redirect_to signup_steps_path(3) and return
|
||||||
|
else
|
||||||
|
complete_signup
|
||||||
|
msg = "Almost done! We have sent you an email to confirm your address."
|
||||||
|
redirect_to(check_your_email_path, notice: msg) and return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def user_params
|
||||||
|
params.require(:user).permit(:cn, :email, :password)
|
||||||
|
end
|
||||||
|
|
||||||
|
def require_invitation
|
||||||
|
if session[:invitation_token].blank?
|
||||||
|
flash.now[:alert] = "You need an invitation to sign up for an account."
|
||||||
|
http_status :unauthorized
|
||||||
|
elsif !valid_invitation?(session[:invitation_token])
|
||||||
|
flash.now[:alert] = "This invitation either doesn't exist or has already been used."
|
||||||
|
http_status :unauthorized
|
||||||
|
end
|
||||||
|
|
||||||
|
@invitation = Invitation.find_by(token: session[:invitation_token])
|
||||||
|
end
|
||||||
|
|
||||||
|
def valid_invitation?(token)
|
||||||
|
Invitation.where(token: session[:invitation_token], used_at: nil).exists?
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_invitation
|
||||||
|
@invitation = Invitation.find_by(token: session[:invitation_token])
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_new_user
|
||||||
|
if session[:new_user].present?
|
||||||
|
@user = User.new(session[:new_user])
|
||||||
|
else
|
||||||
|
@user = User.new(ou: "kosmos.org")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def complete_signup
|
||||||
|
session[:new_user] = nil
|
||||||
|
session[:validation_error] = nil
|
||||||
|
|
||||||
|
CreateAccount.call(
|
||||||
|
username: @user.cn,
|
||||||
|
domain: "kosmos.org",
|
||||||
|
email: @user.email,
|
||||||
|
password: @user.password,
|
||||||
|
invitation: @invitation
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
47
app/controllers/wallet_controller.rb
Normal file
47
app/controllers/wallet_controller.rb
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
require "rqrcode"
|
||||||
|
|
||||||
|
class WalletController < ApplicationController
|
||||||
|
before_action :require_user_signed_in
|
||||||
|
before_action :authenticate_with_lndhub
|
||||||
|
|
||||||
|
def index
|
||||||
|
@current_section = :wallet
|
||||||
|
|
||||||
|
@wallet_url = "lndhub://#{current_user.ln_login}:#{current_user.ln_password}@#{ENV['LNDHUB_PUBLIC_URL']}"
|
||||||
|
|
||||||
|
qrcode = RQRCode::QRCode.new(@wallet_url)
|
||||||
|
@svg = qrcode.as_svg(
|
||||||
|
color: "000",
|
||||||
|
shape_rendering: "crispEdges",
|
||||||
|
module_size: 6,
|
||||||
|
standalone: true,
|
||||||
|
use_path: true,
|
||||||
|
svg_attributes: {
|
||||||
|
class: 'inline-block'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
@balance = fetch_balance rescue nil
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def authenticate_with_lndhub
|
||||||
|
if session["ln_auth_token"].present?
|
||||||
|
@ln_auth_token = session["ln_auth_token"]
|
||||||
|
else
|
||||||
|
lndhub = Lndhub.new
|
||||||
|
auth_token = lndhub.authenticate(current_user)
|
||||||
|
session["ln_auth_token"] = auth_token
|
||||||
|
@ln_auth_token = auth_token
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
# TODO add exception tracking
|
||||||
|
end
|
||||||
|
|
||||||
|
def fetch_balance
|
||||||
|
lndhub = Lndhub.new
|
||||||
|
data = lndhub.balance @ln_auth_token
|
||||||
|
data["BTC"]["AvailableBalance"]
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,2 +1,5 @@
|
|||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
|
def sats_to_btc(sats)
|
||||||
|
sats.to_f / 100000000
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
2
app/helpers/donations_helper.rb
Normal file
2
app/helpers/donations_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module DonationsHelper
|
||||||
|
end
|
||||||
2
app/helpers/invitations_helper.rb
Normal file
2
app/helpers/invitations_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module InvitationsHelper
|
||||||
|
end
|
||||||
2
app/helpers/lnurlpay_helper.rb
Normal file
2
app/helpers/lnurlpay_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module LnurlpayHelper
|
||||||
|
end
|
||||||
2
app/helpers/signup_helper.rb
Normal file
2
app/helpers/signup_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module SignupHelper
|
||||||
|
end
|
||||||
2
app/helpers/wallet_helper.rb
Normal file
2
app/helpers/wallet_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
module WalletHelper
|
||||||
|
end
|
||||||
3
app/javascript/application.js
Normal file
3
app/javascript/application.js
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
|
||||||
|
import "@hotwired/turbo-rails"
|
||||||
|
// import "controllers"
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
// Action Cable provides the framework to deal with WebSockets in Rails.
|
|
||||||
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
|
|
||||||
|
|
||||||
import { createConsumer } from "@rails/actioncable"
|
|
||||||
|
|
||||||
export default createConsumer()
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
// Load all the channels within this directory and all subdirectories.
|
|
||||||
// Channel files must be named *_channel.js.
|
|
||||||
|
|
||||||
const channels = require.context('.', true, /_channel\.js$/)
|
|
||||||
channels.keys().forEach(channels)
|
|
||||||
9
app/javascript/controllers/application.js
Normal file
9
app/javascript/controllers/application.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { Application } from "@hotwired/stimulus"
|
||||||
|
|
||||||
|
const application = Application.start()
|
||||||
|
|
||||||
|
// Configure Stimulus development experience
|
||||||
|
application.debug = false
|
||||||
|
window.Stimulus = application
|
||||||
|
|
||||||
|
export { application }
|
||||||
7
app/javascript/controllers/hello_controller.js
Normal file
7
app/javascript/controllers/hello_controller.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import { Controller } from "@hotwired/stimulus"
|
||||||
|
|
||||||
|
export default class extends Controller {
|
||||||
|
connect() {
|
||||||
|
this.element.textContent = "Hello World!"
|
||||||
|
}
|
||||||
|
}
|
||||||
11
app/javascript/controllers/index.js
Normal file
11
app/javascript/controllers/index.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// Import and register all your controllers from the importmap under controllers/*
|
||||||
|
|
||||||
|
import { application } from "controllers/application"
|
||||||
|
|
||||||
|
// Eager load all controllers defined in the import map under controllers/**/*_controller
|
||||||
|
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||||||
|
eagerLoadControllersFrom("controllers", application)
|
||||||
|
|
||||||
|
// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
|
||||||
|
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
|
||||||
|
// lazyLoadControllersFrom("controllers", application)
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
// This file is automatically compiled by Webpack, along with any other files
|
|
||||||
// present in this directory. You're encouraged to place your actual application logic in
|
|
||||||
// a relevant structure within app/javascript and only use these pack files to reference
|
|
||||||
// that code so it'll be compiled.
|
|
||||||
|
|
||||||
require("@rails/ujs").start()
|
|
||||||
require("turbolinks").start()
|
|
||||||
require("channels")
|
|
||||||
|
|
||||||
|
|
||||||
// Uncomment to copy all static images under ../images to the output folder and reference
|
|
||||||
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
|
|
||||||
// or the `imagePath` JavaScript helper below.
|
|
||||||
//
|
|
||||||
// const images = require.context('../images', true)
|
|
||||||
// const imagePath = (name) => images(name, true)
|
|
||||||
32
app/jobs/create_ldap_user_job.rb
Normal file
32
app/jobs/create_ldap_user_job.rb
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
class CreateLdapUserJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(username, domain, email, hashed_pw)
|
||||||
|
dn = "cn=#{username},ou=#{domain},cn=users,dc=kosmos,dc=org"
|
||||||
|
attr = {
|
||||||
|
objectclass: ["top", "account", "person", "extensibleObject"],
|
||||||
|
cn: username,
|
||||||
|
sn: username,
|
||||||
|
uid: username,
|
||||||
|
mail: email,
|
||||||
|
userPassword: hashed_pw
|
||||||
|
}
|
||||||
|
|
||||||
|
ldap_client.add(dn: dn, attributes: attr)
|
||||||
|
end
|
||||||
|
|
||||||
|
def ldap_client
|
||||||
|
ldap_client ||= Net::LDAP.new host: ldap_config['host'],
|
||||||
|
port: ldap_config['port'],
|
||||||
|
encryption: ldap_config['ssl'],
|
||||||
|
auth: {
|
||||||
|
method: :simple,
|
||||||
|
username: ldap_config['admin_user'],
|
||||||
|
password: ldap_config['admin_password']
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def ldap_config
|
||||||
|
ldap_config ||= YAML.load(ERB.new(File.read("#{Rails.root}/config/ldap.yml")).result)[Rails.env]
|
||||||
|
end
|
||||||
|
end
|
||||||
13
app/jobs/create_lndhub_wallet_job.rb
Normal file
13
app/jobs/create_lndhub_wallet_job.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class CreateLndhubWalletJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(user)
|
||||||
|
return if user.ln_login.present? && user.ln_password.present?
|
||||||
|
|
||||||
|
lndhub = Lndhub.new
|
||||||
|
credentials = lndhub.create({ partnerid: user.ou, accounttype: "user" })
|
||||||
|
|
||||||
|
user.update! ln_login: credentials["login"],
|
||||||
|
ln_password: credentials["password"]
|
||||||
|
end
|
||||||
|
end
|
||||||
18
app/jobs/exchange_xmpp_contacts_job.rb
Normal file
18
app/jobs/exchange_xmpp_contacts_job.rb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
class ExchangeXmppContactsJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(inviter, username, domain)
|
||||||
|
ejabberd = EjabberdApiClient.new
|
||||||
|
|
||||||
|
ejabberd.add_rosteritem({
|
||||||
|
"localuser": username, "localhost": domain,
|
||||||
|
"user": inviter.cn, "host": inviter.ou,
|
||||||
|
"nick": inviter.cn, "group": "Friends", "subs": "both"
|
||||||
|
})
|
||||||
|
ejabberd.add_rosteritem({
|
||||||
|
"localuser": inviter.cn, "localhost": inviter.ou,
|
||||||
|
"user": username, "host": domain,
|
||||||
|
"nick": username, "group": "Friends", "subs": "both"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
15
app/models/concerns/email_validatable.rb
Normal file
15
app/models/concerns/email_validatable.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
require 'mail'
|
||||||
|
|
||||||
|
module EmailValidatable
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
class EmailValidator < ActiveModel::EachValidator
|
||||||
|
def validate_each(record, attribute, value)
|
||||||
|
begin
|
||||||
|
a = Mail::Address.new(value)
|
||||||
|
rescue Mail::Field::ParseError
|
||||||
|
record.errors[attribute] << (options[:message] || "is not a valid address")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
13
app/models/donation.rb
Normal file
13
app/models/donation.rb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
class Donation < ApplicationRecord
|
||||||
|
# Relations
|
||||||
|
belongs_to :user
|
||||||
|
|
||||||
|
# Validations
|
||||||
|
validates_presence_of :amount_sats
|
||||||
|
|
||||||
|
# Hooks
|
||||||
|
# TODO before_create :store_fiat_value
|
||||||
|
|
||||||
|
#Scopes
|
||||||
|
scope :completed, -> { where.not(paid_at: nil) }
|
||||||
|
end
|
||||||
20
app/models/invitation.rb
Normal file
20
app/models/invitation.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
class Invitation < ApplicationRecord
|
||||||
|
# Relations
|
||||||
|
belongs_to :user
|
||||||
|
|
||||||
|
# Validations
|
||||||
|
validates_presence_of :user
|
||||||
|
|
||||||
|
# Hooks
|
||||||
|
before_create :generate_token
|
||||||
|
|
||||||
|
# Scopes
|
||||||
|
scope :unused, -> { where(used_at: nil) }
|
||||||
|
scope :used, -> { where.not(used_at: nil) }
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def generate_token
|
||||||
|
self.token = SecureRandom.hex(8)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,4 +1,18 @@
|
|||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
|
include EmailValidatable
|
||||||
|
|
||||||
|
# Relations
|
||||||
|
has_many :invitations, dependent: :destroy
|
||||||
|
has_many :donations, dependent: :nullify
|
||||||
|
|
||||||
|
validates_uniqueness_of :cn
|
||||||
|
validates_length_of :cn, :minimum => 3
|
||||||
|
validates_uniqueness_of :email
|
||||||
|
validates :email, email: true
|
||||||
|
|
||||||
|
lockbox_encrypts :ln_login
|
||||||
|
lockbox_encrypts :ln_password
|
||||||
|
|
||||||
# Include default devise modules. Others available are:
|
# Include default devise modules. Others available are:
|
||||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||||
devise :ldap_authenticatable,
|
devise :ldap_authenticatable,
|
||||||
@@ -33,4 +47,19 @@ class User < ApplicationRecord
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def address
|
||||||
|
"#{self.cn}@#{self.ou}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def valid_attribute?(attribute_name)
|
||||||
|
self.valid?
|
||||||
|
self.errors[attribute_name].blank?
|
||||||
|
end
|
||||||
|
|
||||||
|
def ln_create_invoice(payload)
|
||||||
|
lndhub = Lndhub.new
|
||||||
|
lndhub.authenticate self
|
||||||
|
lndhub.addinvoice payload
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
7
app/services/application_service.rb
Normal file
7
app/services/application_service.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
class ApplicationService
|
||||||
|
# This enables executing a service's `#call` method directly via
|
||||||
|
# `MyService.call(args)`, without creating a class instance it first.
|
||||||
|
def self.call(*args, &block)
|
||||||
|
new(*args, &block).call
|
||||||
|
end
|
||||||
|
end
|
||||||
52
app/services/create_account.rb
Normal file
52
app/services/create_account.rb
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
class CreateAccount < ApplicationService
|
||||||
|
def initialize(args)
|
||||||
|
@username = args[:username]
|
||||||
|
@domain = args[:ou] || "kosmos.org"
|
||||||
|
@email = args[:email]
|
||||||
|
@password = args[:password]
|
||||||
|
@invitation = args[:invitation]
|
||||||
|
end
|
||||||
|
|
||||||
|
def call
|
||||||
|
user = create_user_in_database
|
||||||
|
add_ldap_document
|
||||||
|
create_lndhub_wallet(user)
|
||||||
|
|
||||||
|
if @invitation.present?
|
||||||
|
update_invitation(user.id)
|
||||||
|
exchange_xmpp_contacts
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def create_user_in_database
|
||||||
|
User.create!(
|
||||||
|
cn: @username,
|
||||||
|
ou: @domain,
|
||||||
|
email: @email,
|
||||||
|
password: @password,
|
||||||
|
password_confirmation: @password
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_invitation(user_id)
|
||||||
|
@invitation.update! invited_user_id: user_id, used_at: DateTime.now
|
||||||
|
end
|
||||||
|
|
||||||
|
# TODO move to confirmation
|
||||||
|
def add_ldap_document
|
||||||
|
hashed_pw = Devise.ldap_auth_password_builder.call(@password)
|
||||||
|
CreateLdapUserJob.perform_later(@username, @domain, @email, hashed_pw)
|
||||||
|
end
|
||||||
|
|
||||||
|
def exchange_xmpp_contacts
|
||||||
|
#TODO enable in development when we have easy setup of ejabberd etc.
|
||||||
|
return if Rails.env.development?
|
||||||
|
ExchangeXmppContactsJob.perform_later(@invitation.user, @username, @domain)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create_lndhub_wallet(user)
|
||||||
|
CreateLndhubWalletJob.perform_later(user)
|
||||||
|
end
|
||||||
|
end
|
||||||
20
app/services/ejabberd_api_client.rb
Normal file
20
app/services/ejabberd_api_client.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
class EjabberdApiClient
|
||||||
|
def initialize
|
||||||
|
@base_url = ENV["EJABBERD_API_URL"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def post(endpoint, payload)
|
||||||
|
res = Faraday.post("#{@base_url}/#{endpoint}", payload.to_json,
|
||||||
|
"Content-Type" => "application/json")
|
||||||
|
|
||||||
|
if res.status != 200
|
||||||
|
Rails.logger.error "[ejabberd] API request failed:"
|
||||||
|
Rails.logger.error res.body
|
||||||
|
#TODO add some kind of exception tracking/notifications
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_rosteritem(payload)
|
||||||
|
post "add_rosteritem", payload
|
||||||
|
end
|
||||||
|
end
|
||||||
57
app/services/lndhub.rb
Normal file
57
app/services/lndhub.rb
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
class Lndhub
|
||||||
|
attr_accessor :auth_token
|
||||||
|
|
||||||
|
def initialize
|
||||||
|
@base_url = ENV["LNDHUB_API_URL"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def post(endpoint, payload)
|
||||||
|
headers = { "Content-Type" => "application/json" }
|
||||||
|
if auth_token
|
||||||
|
headers.merge!({ "Authorization" => "Bearer #{auth_token}" })
|
||||||
|
end
|
||||||
|
|
||||||
|
res = Faraday.post "#{@base_url}/#{endpoint}", payload.to_json, headers
|
||||||
|
|
||||||
|
if res.status != 200
|
||||||
|
Rails.logger.error "[lndhub] API request failed:"
|
||||||
|
Rails.logger.error res.body
|
||||||
|
#TODO add some kind of exception tracking/notifications
|
||||||
|
end
|
||||||
|
|
||||||
|
JSON.parse(res.body)
|
||||||
|
end
|
||||||
|
|
||||||
|
def get(endpoint, auth_token)
|
||||||
|
res = Faraday.get("#{@base_url}/#{endpoint}", {}, {
|
||||||
|
"Content-Type" => "application/json",
|
||||||
|
"Accept" => "application/json",
|
||||||
|
"Authorization" => "Bearer #{auth_token}"
|
||||||
|
})
|
||||||
|
|
||||||
|
JSON.parse(res.body)
|
||||||
|
end
|
||||||
|
|
||||||
|
def create(payload)
|
||||||
|
post "create", payload
|
||||||
|
end
|
||||||
|
|
||||||
|
def authenticate(user)
|
||||||
|
credentials = post "auth?type=auth", { login: user.ln_login, password: user.ln_password }
|
||||||
|
self.auth_token = credentials["access_token"]
|
||||||
|
self.auth_token
|
||||||
|
end
|
||||||
|
|
||||||
|
def balance(user_token)
|
||||||
|
get "balance", user_token || auth_token
|
||||||
|
end
|
||||||
|
|
||||||
|
def addinvoice(payload)
|
||||||
|
invoice = post "addinvoice", {
|
||||||
|
amt: payload[:amount],
|
||||||
|
description_hash: payload[:description_hash]
|
||||||
|
}
|
||||||
|
|
||||||
|
invoice["payment_request"]
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
<h2>Admin Panel</h2>
|
<p class="text-center">
|
||||||
<p>
|
With great power comes great responsibility.
|
||||||
Ohai there, admin human.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<%= link_to 'LDAP users', admin_ldap_users_path %>
|
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
2
app/views/admin/donations/_donation.json.jbuilder
Normal file
2
app/views/admin/donations/_donation.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
json.extract! donation, :id, :user_id, :amount_sats, :amount_eur, :amount_usd, :public_name, :created_at, :updated_at
|
||||||
|
json.url donation_url(donation, format: :json)
|
||||||
58
app/views/admin/donations/_form.html.erb
Normal file
58
app/views/admin/donations/_form.html.erb
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<%= form_with(url: url, model: donation, local: true) do |form| %>
|
||||||
|
<% if donation.errors.any? %>
|
||||||
|
<div id="error_explanation">
|
||||||
|
<h3><%= pluralize(donation.errors.count, "error") %> prohibited this donation from being saved:</h3>
|
||||||
|
<ul>
|
||||||
|
<% donation.errors.full_messages.each do |message| %>
|
||||||
|
<li><%= message %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<p>
|
||||||
|
<%= form.label :user_id %>
|
||||||
|
<%= form.collection_select :user_id, User.where(ou: "kosmos.org").order(:cn), :id, :cn %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<p>
|
||||||
|
<%= form.label :amount_sats, "Amount BTC (sats)" %>
|
||||||
|
<%= form.number_field :amount_sats %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<p>
|
||||||
|
<%= form.label :amount_eur, "Amount EUR (cents)" %>
|
||||||
|
<%= form.number_field :amount_eur %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<p>
|
||||||
|
<%= form.label :amount_usd, "Amount USD (cents)"%>
|
||||||
|
<%= form.number_field :amount_usd %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<p>
|
||||||
|
<%= form.label :public_name %>
|
||||||
|
<%= form.text_field :public_name %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="field">
|
||||||
|
<p>
|
||||||
|
<%= form.label :paid_at %>
|
||||||
|
<%= form.text_field :paid_at %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="mt-8">
|
||||||
|
<%= form.submit class: 'btn-md btn-blue' %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
8
app/views/admin/donations/edit.html.erb
Normal file
8
app/views/admin/donations/edit.html.erb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<h2>Editing Donation</h2>
|
||||||
|
|
||||||
|
<%= render 'form', donation: @donation, url: admin_donation_path(@donation) %>
|
||||||
|
|
||||||
|
<p class="mt-8">
|
||||||
|
<%= link_to 'Show', admin_donation_path(@donation), class: 'ks-text-link' %> |
|
||||||
|
<%= link_to 'Back', admin_donations_path, class: 'ks-text-link' %>
|
||||||
|
<p>
|
||||||
41
app/views/admin/donations/index.html.erb
Normal file
41
app/views/admin/donations/index.html.erb
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<h2>Donations</h2>
|
||||||
|
|
||||||
|
<% if @donations.any? %>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>User</th>
|
||||||
|
<th>Amount BTC</th>
|
||||||
|
<th>in EUR</th>
|
||||||
|
<th>in USD</th>
|
||||||
|
<th>Public name</th>
|
||||||
|
<th>Date</th>
|
||||||
|
<th colspan="3"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<% @donations.each do |donation| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= donation.user.cn %></td>
|
||||||
|
<td><%= sats_to_btc donation.amount_sats %> BTC</td>
|
||||||
|
<td><%= number_to_currency donation.amount_eur / 100, unit: "" %></td>
|
||||||
|
<td><%= number_to_currency donation.amount_usd / 100, unit: "" %></td>
|
||||||
|
<td><%= donation.public_name %></td>
|
||||||
|
<td><%= donation.paid_at ? donation.paid_at.strftime("%Y-%m-%d") : "" %></td>
|
||||||
|
<td><%= link_to 'Show', admin_donation_path(donation), class: 'btn btn-sm btn-gray' %></td>
|
||||||
|
<td><%= link_to 'Edit', edit_admin_donation_path(donation), class: 'btn btn-sm btn-gray' %></td>
|
||||||
|
<td><%= link_to 'Destroy', admin_donation_path(donation), class: 'btn btn-sm btn-red', method: :delete, data: { confirm: 'Are you sure?' } %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<p>
|
||||||
|
No donations yet.
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<p class="mt-12">
|
||||||
|
<%= link_to 'Record an out-of-system donation', new_admin_donation_path, class: 'btn-md btn-gray' %>
|
||||||
|
</p>
|
||||||
1
app/views/admin/donations/index.json.jbuilder
Normal file
1
app/views/admin/donations/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.array! @donations, partial: "donations/donation", as: :donation
|
||||||
7
app/views/admin/donations/new.html.erb
Normal file
7
app/views/admin/donations/new.html.erb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<h2>New Donation</h2>
|
||||||
|
|
||||||
|
<%= render 'form', donation: @donation, url: admin_donations_path %>
|
||||||
|
|
||||||
|
<p class="mt-8">
|
||||||
|
<%= link_to 'Back', admin_donations_path, class: 'ks-text-link' %>
|
||||||
|
</p>
|
||||||
36
app/views/admin/donations/show.html.erb
Normal file
36
app/views/admin/donations/show.html.erb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<p id="notice"><%= notice %></p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>User:</strong>
|
||||||
|
<%= @donation.user_id %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Amount sats:</strong>
|
||||||
|
<%= @donation.amount_sats %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Amount eur:</strong>
|
||||||
|
<%= @donation.amount_eur %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Amount usd:</strong>
|
||||||
|
<%= @donation.amount_usd %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Public name:</strong>
|
||||||
|
<%= @donation.public_name %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<strong>Date:</strong>
|
||||||
|
<%= @donation.paid_at %>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="mt-8">
|
||||||
|
<%= link_to 'Edit', edit_admin_donation_path(@donation), class: 'ks-text-link' %> |
|
||||||
|
<%= link_to 'Back', admin_donations_path, class: 'ks-text-link' %>
|
||||||
|
</p>
|
||||||
1
app/views/admin/donations/show.json.jbuilder
Normal file
1
app/views/admin/donations/show.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.partial! "donations/donation", donation: @donation
|
||||||
32
app/views/admin/invitations/index.html.erb
Normal file
32
app/views/admin/invitations/index.html.erb
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<section>
|
||||||
|
<h2>Invitations</h2>
|
||||||
|
<p>
|
||||||
|
There are currently <strong><%= @invitations_unused_count %>
|
||||||
|
unused invitations</strong> available to existing users.
|
||||||
|
<strong><%= @users_with_referrals_count %> users</strong> have successfully
|
||||||
|
invited new users.
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
<% if @invitations_used.any? %>
|
||||||
|
<section>
|
||||||
|
<h3>Accepted (<%= @invitations_used.length %>)</h3>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Token</th>
|
||||||
|
<th>Accepted</th>
|
||||||
|
<th>Invited user</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @invitations_used.each do |invitation| %>
|
||||||
|
<tr>
|
||||||
|
<td class="overflow-ellipsis"><%= invitation.token %></td>
|
||||||
|
<td><%= invitation.used_at.strftime("%Y-%m-%d") %></td>
|
||||||
|
<td><%= User.find(invitation.invited_user_id).address %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
<% end %>
|
||||||
@@ -1,8 +1,13 @@
|
|||||||
<h2>LDAP users</h2>
|
<h2>LDAP users: <%= @ou %></h2>
|
||||||
|
|
||||||
<ul>
|
<h3 class="hidden">Domains</h3>
|
||||||
<li><%= link_to 'kosmos.org', admin_ldap_users_path %></li>
|
<ul class="mb-10">
|
||||||
<li><%= link_to '5apps.com', admin_ldap_users_path(ou: '5apps.com') %></li>
|
<li class="inline-block">
|
||||||
|
<%= link_to 'kosmos.org', admin_ldap_users_path, class: "ks-text-link" %>
|
||||||
|
</li>
|
||||||
|
<li class="inline-block ml-6">
|
||||||
|
<%= link_to '5apps.com', admin_ldap_users_path(ou: '5apps.com'), class: "ks-text-link" %>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
|||||||
@@ -4,45 +4,55 @@
|
|||||||
Your Kosmos account and password currently give you access to these
|
Your Kosmos account and password currently give you access to these
|
||||||
services:
|
services:
|
||||||
</p>
|
</p>
|
||||||
<div class="grid services">
|
<div class="grid services mt-12">
|
||||||
<div class="grid-item chat">
|
<div>
|
||||||
<h3><%= link_to "Chat", "https://wiki.kosmos.org/Services:XMPP" %></h3>
|
<h3 class="mb-3.5">
|
||||||
<p>
|
<%= link_to "Chat", "https://wiki.kosmos.org/Services:Chat", class: "ks-text-link" %>
|
||||||
|
</h3>
|
||||||
|
<p class="text-gray-500">
|
||||||
Chat rooms and instant messaging (XMPP/Jabber)
|
Chat rooms and instant messaging (XMPP/Jabber)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-item gitea">
|
<div>
|
||||||
<h3><%= link_to "Gitea", "https://gitea.kosmos.org" %></h3>
|
<h3 class="mb-3.5">
|
||||||
<p>
|
<%= link_to "Discourse", "https://community.kosmos.org", class: "ks-text-link" %>
|
||||||
Code hosting and collaboration for software projects
|
</h3>
|
||||||
|
<p class="text-gray-500">
|
||||||
|
Kosmos community forums and user support/help site
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-item gitea">
|
<div>
|
||||||
<h3><%= link_to "Drone CI", "https://drone.kosmos.org" %></h3>
|
<h3 class="mb-3.5">
|
||||||
<p>
|
<span class="text-yellow-500">🗲</span>
|
||||||
Continuous integration for software projects, tied to our Gitea
|
<%= link_to "Lightning Wallet", wallet_path, class: "ks-text-link" %>
|
||||||
|
</h3>
|
||||||
|
<p class="text-gray-500">
|
||||||
|
Send and receive sats over the Bitcoin Lightning Network
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-item wiki">
|
<div>
|
||||||
<h3><%= link_to "Wiki", "https://wiki.kosmos.org" %></h3>
|
<h3 class="mb-3.5">
|
||||||
<p>
|
<%= link_to "Wiki", "https://wiki.kosmos.org", class: "ks-text-link" %>
|
||||||
|
</h3>
|
||||||
|
<p class="text-gray-500">
|
||||||
Kosmos documentation and knowledge base
|
Kosmos documentation and knowledge base
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid-item discourse">
|
<div>
|
||||||
<h3><%= link_to "Discourse", "https://community.kosmos.org" %></h3>
|
<h3 class="mb-3.5">
|
||||||
<p>
|
<%= link_to "Gitea", "https://gitea.kosmos.org", class: "ks-text-link" %>
|
||||||
Kosmos community forums and user support/help site
|
</h3>
|
||||||
|
<p class="text-gray-500">
|
||||||
|
Code hosting and collaboration for software projects
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3 class="mb-3.5">
|
||||||
|
<%= link_to "Drone CI", "https://drone.kosmos.org", class: "ks-text-link" %>
|
||||||
|
</h3>
|
||||||
|
<p class="text-gray-500">
|
||||||
|
Continuous integration for software projects on Gitea
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
|
||||||
<h3>Password change</h3>
|
|
||||||
<p>
|
|
||||||
<%= form_with(url: settings_reset_password_path, method: :post) do %>
|
|
||||||
<%= submit_tag("Send me a password reset link") %>
|
|
||||||
<% end %>
|
|
||||||
</p>
|
|
||||||
</section>
|
|
||||||
|
|||||||
@@ -2,19 +2,13 @@
|
|||||||
|
|
||||||
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
||||||
<%= render "devise/shared/error_messages", resource: resource %>
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
<p>
|
||||||
<div class="field">
|
<%= f.label :email, 'Email address', class: 'block mb-1' %>
|
||||||
<p>
|
<%= f.email_field :email, required: true, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
||||||
<%= f.label :email, 'Email address' %><br />
|
</p>
|
||||||
<%= f.email_field :email, required: true, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
<p class="mt-8">
|
||||||
</p>
|
<%= f.submit "Resend confirmation instructions", class: 'btn-md btn-blue' %>
|
||||||
</div>
|
</p>
|
||||||
|
|
||||||
<div class="actions">
|
|
||||||
<p>
|
|
||||||
<%= f.submit "Resend confirmation instructions" %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
<%= render "devise/shared/links" %>
|
||||||
|
|||||||
@@ -4,22 +4,24 @@
|
|||||||
<%= render "devise/shared/error_messages", resource: resource %>
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
<%= f.hidden_field :reset_password_token %>
|
<%= f.hidden_field :reset_password_token %>
|
||||||
|
|
||||||
<div class="field">
|
<p class="mb-1">
|
||||||
<%= f.label :password, "New password" %><br />
|
<%= f.label :password, "New password" %>
|
||||||
<% if @minimum_password_length %>
|
</p>
|
||||||
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
<p>
|
||||||
<% end %>
|
|
||||||
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
|
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
|
||||||
</div>
|
<% if @minimum_password_length %>
|
||||||
|
<br><em class="text-sm text-gray-500">(<%= @minimum_password_length %> characters minimum)</em>
|
||||||
<div class="field">
|
<% end %>
|
||||||
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
</p>
|
||||||
|
<p class="mb-1">
|
||||||
|
<%= f.label :password_confirmation, "Confirm new password" %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
||||||
</div>
|
</p>
|
||||||
|
<p class="mt-8">
|
||||||
<div class="actions">
|
<%= f.submit "Change my password", class: 'btn-md btn-blue' %>
|
||||||
<%= f.submit "Change my password" %>
|
</p>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
<%= render "devise/shared/links" %>
|
||||||
|
|||||||
@@ -2,26 +2,17 @@
|
|||||||
|
|
||||||
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
|
||||||
<%= render "devise/shared/error_messages", resource: resource %>
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
<p>
|
||||||
<div class="field">
|
<%= f.label :cn, 'User', class: 'block' %>
|
||||||
<p>
|
<%= f.text_field :cn, autofocus: true, autocomplete: "username", required: true %> @ kosmos.org
|
||||||
<%= f.label :cn, 'User' %><br />
|
</p>
|
||||||
<%= f.text_field :cn, autofocus: true, autocomplete: "username", required: true %> @ kosmos.org
|
<p>
|
||||||
</p>
|
<%= f.label :email, 'Email address', class: 'block' %>
|
||||||
</div>
|
<%= f.email_field :email, autocomplete: "email", required: true %>
|
||||||
|
</p>
|
||||||
<div class="field">
|
<p class="mt-8">
|
||||||
<p>
|
<%= f.submit "Send me reset password instructions", class: 'btn-md btn-blue' %>
|
||||||
<%= f.label :email, 'Email address' %><br />
|
</p>
|
||||||
<%= f.email_field :email, autocomplete: "email", required: true %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="actions">
|
|
||||||
<p>
|
|
||||||
<%= f.submit "Send me reset password instructions" %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
<%= render "devise/shared/links" %>
|
||||||
|
|||||||
@@ -31,9 +31,9 @@
|
|||||||
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<p class="mt-8">
|
||||||
<%= f.submit "Update" %>
|
<%= f.submit "Update", class: 'btn-md btn-blue' %>
|
||||||
</div>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<h3>Cancel my account</h3>
|
<h3>Cancel my account</h3>
|
||||||
|
|||||||
@@ -2,24 +2,17 @@
|
|||||||
|
|
||||||
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
|
||||||
<%= render "devise/shared/error_messages", resource: resource %>
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
<p>
|
||||||
<div class="field">
|
<%= f.label :cn, 'User', class: 'block' %>
|
||||||
<p>
|
<%= f.text_field :cn, autofocus: true, autocomplete: "username" %> @ kosmos.org
|
||||||
<%= f.label :cn, 'User' %><br />
|
</p>
|
||||||
<%= f.text_field :cn, autofocus: true, autocomplete: "username" %> @ kosmos.org
|
<p>
|
||||||
</p>
|
<%= f.label :password, class: 'block' %>
|
||||||
</div>
|
<%= f.password_field :password, autocomplete: "current-password" %>
|
||||||
<div class="field">
|
</p>
|
||||||
<p>
|
<p class="mt-8">
|
||||||
<%= f.label :password %><br />
|
<%= f.submit "Log in", class: 'btn-md btn-blue' %>
|
||||||
<%= f.password_field :password, autocomplete: "current-password" %>
|
</p>
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div class="actions">
|
|
||||||
<p>
|
|
||||||
<%= f.submit "Log in" %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
<%= render "devise/shared/links" %>
|
||||||
|
|||||||
@@ -1,24 +1,24 @@
|
|||||||
<div class="devise-links">
|
<div class="devise-links mt-8 text-sm">
|
||||||
<%- if controller_name != 'sessions' %>
|
<%- if controller_name != 'sessions' %>
|
||||||
<p>
|
<p class="mb-1.5">
|
||||||
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
||||||
<p>
|
<p class="mb-1.5">
|
||||||
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
||||||
<p>
|
<p class="mb-1.5">
|
||||||
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
||||||
<p>
|
<p class="mb-1.5">
|
||||||
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -2,15 +2,13 @@
|
|||||||
|
|
||||||
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
|
||||||
<%= render "devise/shared/error_messages", resource: resource %>
|
<%= render "devise/shared/error_messages", resource: resource %>
|
||||||
|
<p>
|
||||||
<div class="field">
|
|
||||||
<%= f.label :email %><br />
|
<%= f.label :email %><br />
|
||||||
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
||||||
</div>
|
</p>
|
||||||
|
<p class="mt-8">
|
||||||
<div class="actions">
|
<%= f.submit "Resend unlock instructions", class: 'btn-md btn-blue' %>
|
||||||
<%= f.submit "Resend unlock instructions" %>
|
</p>
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "devise/shared/links" %>
|
<%= render "devise/shared/links" %>
|
||||||
|
|||||||
41
app/views/donations/index.html.erb
Normal file
41
app/views/donations/index.html.erb
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<section>
|
||||||
|
<h2>Donations</h2>
|
||||||
|
<p>
|
||||||
|
Your financial contributions to the development and
|
||||||
|
upkeep of Kosmos software and services.
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<% if @donations.any? %>
|
||||||
|
<ul class="donations list-none">
|
||||||
|
<% @donations.each do |donation| %>
|
||||||
|
<li class="mb-8 grid gap-y-2 gap-x-8 grid-cols-2 items-center">
|
||||||
|
<h3 class="mb-0">
|
||||||
|
<%= donation.paid_at.strftime("%B %d, %Y") %>
|
||||||
|
</h3>
|
||||||
|
<p class="row-span-2 font-mono text-right mb-0">
|
||||||
|
<span class="text-xl">
|
||||||
|
<%= number_with_delimiter donation.amount_sats %> sats
|
||||||
|
</span>
|
||||||
|
<br>
|
||||||
|
<span class="text-sm text-gray-500">
|
||||||
|
(~ <%= number_to_currency donation.amount_eur / 100, unit: "" %> EUR)
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
<p class="mb-0">
|
||||||
|
<% if donation.public_name.present? %>
|
||||||
|
Public name: <%= donation.public_name %>
|
||||||
|
<% else %>
|
||||||
|
Anonymous
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% else %>
|
||||||
|
<p>
|
||||||
|
No donations to show.
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</section>
|
||||||
1
app/views/donations/index.json.jbuilder
Normal file
1
app/views/donations/index.json.jbuilder
Normal file
@@ -0,0 +1 @@
|
|||||||
|
json.array! @donations, partial: "donations/donation", as: :donation
|
||||||
56
app/views/invitations/index.html.erb
Normal file
56
app/views/invitations/index.html.erb
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<section>
|
||||||
|
<h2>Invitations</h2>
|
||||||
|
<% if @invitations_unused.any? %>
|
||||||
|
<p>
|
||||||
|
Invite your friends to a Kosmos account by sharing an invitation URL with them:
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<% if @invitations_unused.any? %>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>URL</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @invitations_unused.each do |invitation| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= invitation_url(invitation.token) %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<p>
|
||||||
|
You do not have any invitations to give away yet. All good
|
||||||
|
things come in time.
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<% if @invitations_used.any? %>
|
||||||
|
<section>
|
||||||
|
<h3>Accepted Invitations</h3>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="hide-small">ID</th>
|
||||||
|
<th>Accepted</th>
|
||||||
|
<th>Invited user</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @invitations_used.each do |invitation| %>
|
||||||
|
<tr>
|
||||||
|
<td class="hide-small"><%= invitation.token %></td>
|
||||||
|
<td><%= invitation.used_at.strftime("%Y-%m-%d") %></td>
|
||||||
|
<td><%= User.find(invitation.invited_user_id).address %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
<% end %>
|
||||||
39
app/views/layouts/admin.html.erb
Normal file
39
app/views/layouts/admin.html.erb
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Admin Panel | Kosmos Accounts</title>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
<%= csp_meta_tag %>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://assets.kosmos.org/fonts/open-sans/open-sans.css" rel="stylesheet">
|
||||||
|
<%= stylesheet_link_tag 'legacy', "data-turbo-track": "reload" %>
|
||||||
|
<%= stylesheet_link_tag 'application', "data-turbo-track": "reload" %>
|
||||||
|
<%= javascript_importmap_tags %>
|
||||||
|
</head>
|
||||||
|
<body id="admin-panel">
|
||||||
|
<div id="wrapper">
|
||||||
|
<header>
|
||||||
|
<h1>
|
||||||
|
<span class ="icon"><%= render partial: "shared/icons/comet" %></span>
|
||||||
|
<span class ="project-name">Kosmos</span>
|
||||||
|
<span class ="site-name">Accounts</span>
|
||||||
|
</h1>
|
||||||
|
<%= render partial: 'shared/header_account' %>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<% if user_signed_in? && current_user.confirmed? %>
|
||||||
|
<%= render partial: 'shared/admin_nav' %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% flash.each do |type, msg| %>
|
||||||
|
<div class="flash-msg <%= type %>">
|
||||||
|
<p><%= msg %></p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<%= yield %>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -4,29 +4,27 @@
|
|||||||
<title>Kosmos Accounts</title>
|
<title>Kosmos Accounts</title>
|
||||||
<%= csrf_meta_tags %>
|
<%= csrf_meta_tags %>
|
||||||
<%= csp_meta_tag %>
|
<%= csp_meta_tag %>
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://assets.kosmos.org/fonts/open-sans/open-sans.css" rel="stylesheet">
|
||||||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'legacy', "data-turbo-track": "reload" %>
|
||||||
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'application', "data-turbo-track": "reload" %>
|
||||||
|
<%= javascript_importmap_tags %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<header>
|
<header>
|
||||||
<h1>
|
<h1>
|
||||||
|
<span class ="icon"><%= render partial: "shared/icons/comet" %></span>
|
||||||
<span class ="project-name">Kosmos</span>
|
<span class ="project-name">Kosmos</span>
|
||||||
<span class ="site-name">Akkounts</span>
|
<span class ="site-name">Account</span>
|
||||||
<span class="beta"><span class="bolt">⚡</span> beta</span>
|
|
||||||
</h1>
|
</h1>
|
||||||
<% if user_signed_in? %>
|
<%= render partial: 'shared/header_account' %>
|
||||||
<p class="current-user">
|
|
||||||
Signed in as <strong><%= current_user.cn %>@kosmos.org</strong>.
|
|
||||||
<%= link_to "Log out", destroy_user_session_path, method: :delete %>
|
|
||||||
</p>
|
|
||||||
<% end %>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
<% if user_signed_in? && current_user.confirmed? %>
|
||||||
|
<%= render partial: 'shared/main_nav' %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% flash.each do |type, msg| %>
|
<% flash.each do |type, msg| %>
|
||||||
<div class="flash-msg <%= type %>">
|
<div class="flash-msg <%= type %>">
|
||||||
<p><%= msg %></p>
|
<p><%= msg %></p>
|
||||||
|
|||||||
40
app/views/layouts/signup.html.erb
Normal file
40
app/views/layouts/signup.html.erb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Sign up | Kosmos Accounts</title>
|
||||||
|
<%= csrf_meta_tags %>
|
||||||
|
<%= csp_meta_tag %>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://assets.kosmos.org/fonts/open-sans/open-sans.css" rel="stylesheet">
|
||||||
|
<%= stylesheet_link_tag 'legacy', "data-turbo-track": "reload" %>
|
||||||
|
<%= stylesheet_link_tag 'application', "data-turbo-track": "reload" %>
|
||||||
|
<%= javascript_importmap_tags %>
|
||||||
|
</head>
|
||||||
|
<body class="layout-signup">
|
||||||
|
<div id="wrapper">
|
||||||
|
<header>
|
||||||
|
<h1>
|
||||||
|
<span class ="icon"><%= render partial: "shared/icons/comet" %></span>
|
||||||
|
<span class ="project-name">Kosmos</span>
|
||||||
|
<span class ="site-name">Sign Up</span>
|
||||||
|
</h1>
|
||||||
|
<% if user_signed_in? %>
|
||||||
|
<p class="current-user">
|
||||||
|
Signed in as <strong><%= current_user.cn %>@kosmos.org</strong>.
|
||||||
|
<%= link_to "Log out", destroy_user_session_path, method: :delete %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<% flash.each do |type, msg| %>
|
||||||
|
<div class="flash-msg <%= type %>">
|
||||||
|
<p><%= msg %></p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<%= yield %>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
12
app/views/security/index.html.erb
Normal file
12
app/views/security/index.html.erb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<section>
|
||||||
|
<h2>Security</h2>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h3>Password change</h3>
|
||||||
|
<p>
|
||||||
|
<%= form_with(url: settings_reset_password_path, method: :post) do %>
|
||||||
|
<%= submit_tag("Send me a password reset link", class: 'btn-md btn-gray') %>
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
22
app/views/shared/_admin_nav.html.erb
Normal file
22
app/views/shared/_admin_nav.html.erb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<nav id="main-nav">
|
||||||
|
<div class="wrapper">
|
||||||
|
<ul class="pages">
|
||||||
|
<li>
|
||||||
|
<%= link_to "Dashboard", admin_root_path,
|
||||||
|
class: @current_section == :dashboard ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "Invitations", admin_invitations_path,
|
||||||
|
class: @current_section == :invitations ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "Donations", admin_donations_path,
|
||||||
|
class: @current_section == :donations ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "LDAP Users", admin_ldap_users_path,
|
||||||
|
class: @current_section == :ldap_users ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
6
app/views/shared/_header_account.html.erb
Normal file
6
app/views/shared/_header_account.html.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<% if user_signed_in? %>
|
||||||
|
<p class="current-user mt-8">
|
||||||
|
Signed in as <strong class="text-white font-normal"><%= current_user.cn %>@kosmos.org</strong>.
|
||||||
|
<%= link_to "Log out", destroy_user_session_path, method: :delete, class: 'underline' %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
26
app/views/shared/_main_nav.html.erb
Normal file
26
app/views/shared/_main_nav.html.erb
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<nav id="main-nav">
|
||||||
|
<div class="wrapper">
|
||||||
|
<ul class="pages">
|
||||||
|
<li>
|
||||||
|
<%= link_to "Services", root_path,
|
||||||
|
class: @current_section == :dashboard ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "Invitations", invitations_path,
|
||||||
|
class: @current_section == :invitations ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "Donations", donations_path,
|
||||||
|
class: @current_section == :contributions ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "Wallet", wallet_path,
|
||||||
|
class: @current_section == :wallet ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<%= link_to "Security", security_path,
|
||||||
|
class: @current_section == :security ? "active" : nil %>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
1
app/views/shared/icons/_comet.html.erb
Normal file
1
app/views/shared/icons/_comet.html.erb
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg id="icon-comet" width="65.364" height="55.773" enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 65.364 55.773" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><g id="layer1" transform="translate(28.868 20.259)" fill="#fff"><path id="path2" d="m22.81-9.2546-0.0137-0.0072c-0.0445-0.0196-0.0895-0.04052-0.13335-0.06078l-23.822-10.937s2.0034 9.219 2.914 11.778c0 0-27.292-8.1582-30.623-8.9354 1.0916 4.2618 20.006 40.848 20.006 40.848 3.8225 7.7608 12.677 12.083 21.912 12.083 12.949 0 23.446-10.497 23.446-23.446 6.6e-4 -9.4655-5.609-17.62-13.685-21.323z" fill="#fff" stroke-width=".65365"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 627 B |
@@ -1,2 +1,2 @@
|
|||||||
<h2>Access forbidden</h2>
|
<h2>Access forbidden</h2>
|
||||||
<p>Not with those shoes, buddy.</p>
|
<p>Sorry, you're not allowed to access this page.</p>
|
||||||
|
|||||||
2
app/views/shared/status_not_found.html.erb
Normal file
2
app/views/shared/status_not_found.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<h2>Not found</h2>
|
||||||
|
<p>Sorry, this page does not exist.</p>
|
||||||
0
app/views/shared/status_unauthorized.html.erb
Normal file
0
app/views/shared/status_unauthorized.html.erb
Normal file
12
app/views/signup/index.html.erb
Normal file
12
app/views/signup/index.html.erb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<h2>Welcome</h2>
|
||||||
|
<p>
|
||||||
|
Hey there! You were invited to sign up for a Kosmos account by
|
||||||
|
<strong><%= @invited_by_name %></strong>.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
This invitation can only be used once, and sign-up is currently only possible
|
||||||
|
by invitation. Seems like you have good friends!
|
||||||
|
</p>
|
||||||
|
<p class="mt-12">
|
||||||
|
<%= link_to "Get started", signup_steps_path(1), class: "btn btn-md btn-blue" %>
|
||||||
|
</p>
|
||||||
54
app/views/signup/steps.html.erb
Normal file
54
app/views/signup/steps.html.erb
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
<% case @step %>
|
||||||
|
<% when 1 %>
|
||||||
|
<h2>Choose a username</h2>
|
||||||
|
<%= form_for @user, :url => signup_validate_url do |f| %>
|
||||||
|
<p>
|
||||||
|
<%= f.label :cn, 'Username', class: 'hidden' %>
|
||||||
|
<%= f.text_field :cn, autofocus: true, autocomplete: "username",
|
||||||
|
class: 'text-xl' %>
|
||||||
|
<span class="text-xl ml-1">@</span>
|
||||||
|
<span class="text-xl">kosmos.org</span>
|
||||||
|
</p>
|
||||||
|
<% if @validation_error.present? %>
|
||||||
|
<p class="error-msg">Username <%= @validation_error %></p>
|
||||||
|
<% end %>
|
||||||
|
<p class="mt-12">
|
||||||
|
<%= f.submit "Continue", class: 'btn btn-md btn-blue' %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% when 2 %>
|
||||||
|
<h2>What's your email?</h2>
|
||||||
|
<%= form_for @user, :url => signup_validate_url do |f| %>
|
||||||
|
<p>
|
||||||
|
<%= f.label :email, 'Email address', class: 'hidden' %>
|
||||||
|
<%= f.email_field :email, autofocus: true, autocomplete: 'email', class: 'text-xl' %>
|
||||||
|
</p>
|
||||||
|
<% if @validation_error.present? %>
|
||||||
|
<p class="error-msg">Email <%= @validation_error %></p>
|
||||||
|
<% end %>
|
||||||
|
<p class="mt-12">
|
||||||
|
<%= f.submit "Continue", class: 'btn btn-md btn-blue' %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<% when 3 %>
|
||||||
|
<h2>Choose a password</h2>
|
||||||
|
|
||||||
|
<%= form_for @user, :url => signup_validate_url do |f| %>
|
||||||
|
<p>
|
||||||
|
<%= f.label :password, 'Password', class: 'hidden' %>
|
||||||
|
<%= f.password_field :password, autofocus: true, class: 'text-xl' %>
|
||||||
|
</p>
|
||||||
|
<% if @validation_error.present? %>
|
||||||
|
<p class="error-msg">Password <%= @validation_error %></p>
|
||||||
|
<% end %>
|
||||||
|
<p class="mt-8 text-sm text-gray-500">
|
||||||
|
By clicking the button below, you accept our future Terms of Service
|
||||||
|
and Privacy Policy. Don't worry, they will be excellent!
|
||||||
|
</p>
|
||||||
|
<p class="mt-8">
|
||||||
|
<%= f.submit "Create account", class: 'btn-md btn-blue' %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
120
app/views/wallet/index.html.erb
Normal file
120
app/views/wallet/index.html.erb
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<section class="w-full grid grid-cols-1 md:grid-cols-12 md:mb-0">
|
||||||
|
<div class="md:col-span-8">
|
||||||
|
<h2>Wallet</h2>
|
||||||
|
<p>
|
||||||
|
Send and receive sats via the Bitcoin Lightning Network.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="md:col-span-4 mt-4 md:mt-0">
|
||||||
|
<p class="font-mono md:text-right mb-0 p-4 border border-gray-300 rounded-lg overflow-hidden">
|
||||||
|
<% if @balance %>
|
||||||
|
<span class="text-xl"><%= number_with_delimiter @balance %> sats</span><br>
|
||||||
|
<span class="text-sm text-gray-500">Available balance</span>
|
||||||
|
<% else %>
|
||||||
|
<span class="text-xl">n/a sats</span><br>
|
||||||
|
<span class="text-sm text-gray-500">Balance unavailable</span>
|
||||||
|
<% end %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h3>Lightning Address</h3>
|
||||||
|
<p>
|
||||||
|
Your Kosmos user address is also a
|
||||||
|
<a class="ks-text-link" href="https://lightningaddress.com/" target="_blank">Lightning Address</a>!
|
||||||
|
The easiest way to receive sats is by just giving out your address:
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong><%= current_user.address %></strong>
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h3>Wallet Apps</h3>
|
||||||
|
<p>
|
||||||
|
You can connect various wallet apps to your Kosmos account. This allows
|
||||||
|
you to both receive and send sats. Any wallet that supports
|
||||||
|
<a href="https://bluewallet.io/lndhub/" class="ks-text-link" target="_blank">LNDHub</a>
|
||||||
|
accounts should be able to add/import your account using our setup
|
||||||
|
code/URL:
|
||||||
|
</p>
|
||||||
|
<p class="my-6 text-center md:text-left">
|
||||||
|
<button id="copy-setup-code" class="btn-md btn-blue">Copy setup code/URL</button>
|
||||||
|
<span class="mx-2 my-2 md:my-0 block md:inline">or</span>
|
||||||
|
<button id="show-setup-code" class="btn-md btn-blue">Show setup QR code</button>
|
||||||
|
<button id="hide-setup-code" class="btn-md btn-blue hidden">Hide setup QR code</button>
|
||||||
|
</p>
|
||||||
|
<p id="setup-code" class="hidden my-10 w-full text-center">
|
||||||
|
<%= raw @svg %>
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h3>Recommended Apps</h3>
|
||||||
|
<div class="w-full grid grid-cols-1 gap-y-4 md:grid-cols-12
|
||||||
|
md:gap-y-6 md:gap-x-4 md:items-center">
|
||||||
|
<h4 class="md:col-span-3">
|
||||||
|
<a href="https://bluewallet.io" class="ks-text-link text-xl"
|
||||||
|
title="Blue Wallet" target="_blank">
|
||||||
|
<%= image_tag("/img/logos/bluewallet.svg", class: 'h-16') %>
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
<p class="md:col-span-4 mb-0 text-gray-500">
|
||||||
|
Android / iOS / macOS
|
||||||
|
</p>
|
||||||
|
<p class="md:col-span-5 mb-0">
|
||||||
|
When adding a wallet, choose "Import wallet" on the bottom of the screen,
|
||||||
|
then scan the setup QR code.
|
||||||
|
</p>
|
||||||
|
<h4 class="md:col-span-3">
|
||||||
|
<a href="https://getalby.com/" class="ks-text-link text-xl"
|
||||||
|
title="Alby" target="_blank">
|
||||||
|
<%= image_tag("/img/logos/alby.svg", class: 'h-16') %>
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
<p class="md:col-span-4 mb-0 text-gray-500">
|
||||||
|
Firefox / Chrome (Opera, Brave, Chromium-based browsers)
|
||||||
|
</p>
|
||||||
|
<p class="md:col-span-5 mb-0">
|
||||||
|
Choose "LNDHub (Bluewallet)" in the connect dialog and paste the setup
|
||||||
|
URL in the "LNDHub Export URI" field.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function () {
|
||||||
|
const buttonShow = document.querySelector('#show-setup-code');
|
||||||
|
const buttonHide = document.querySelector('#hide-setup-code');
|
||||||
|
const buttonCopy = document.querySelector('#copy-setup-code');
|
||||||
|
const setupCode = document.querySelector('#setup-code');
|
||||||
|
|
||||||
|
buttonShow.addEventListener('click', function(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
setupCode.classList.remove('hidden');
|
||||||
|
buttonHide.classList.remove('hidden');
|
||||||
|
buttonShow.classList.add('hidden');
|
||||||
|
setupCode.scrollIntoView({behavior: "smooth", block: "nearest"});
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonHide.addEventListener('click', function(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
const el = document.querySelector('#setup-code');
|
||||||
|
setupCode.classList.add('hidden');
|
||||||
|
buttonHide.classList.add('hidden');
|
||||||
|
buttonShow.classList.remove('hidden');
|
||||||
|
});
|
||||||
|
|
||||||
|
buttonCopy.addEventListener('click', function(ev) {
|
||||||
|
ev.preventDefault();
|
||||||
|
navigator.clipboard.writeText('<%= @wallet_url %>').then(() => {
|
||||||
|
const buttonText = buttonCopy.innerText;
|
||||||
|
buttonCopy.innerText = 'Copied ✔';
|
||||||
|
setTimeout(() => {
|
||||||
|
buttonCopy.innerText = buttonText;
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
9
bin/dev
Executable file
9
bin/dev
Executable file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if ! command -v foreman &> /dev/null
|
||||||
|
then
|
||||||
|
echo "Installing foreman..."
|
||||||
|
gem install foreman
|
||||||
|
fi
|
||||||
|
|
||||||
|
foreman start -f Procfile.dev
|
||||||
29
bin/rspec
Executable file
29
bin/rspec
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
#
|
||||||
|
# This file was generated by Bundler.
|
||||||
|
#
|
||||||
|
# The application 'rspec' is installed as part of a gem, and
|
||||||
|
# this file is here to facilitate running it.
|
||||||
|
#
|
||||||
|
|
||||||
|
require "pathname"
|
||||||
|
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
||||||
|
Pathname.new(__FILE__).realpath)
|
||||||
|
|
||||||
|
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
||||||
|
|
||||||
|
if File.file?(bundle_binstub)
|
||||||
|
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
||||||
|
load(bundle_binstub)
|
||||||
|
else
|
||||||
|
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
||||||
|
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require "rubygems"
|
||||||
|
require "bundler/setup"
|
||||||
|
|
||||||
|
load Gem.bin_path("rspec-core", "rspec")
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user