11 Commits

63 changed files with 465 additions and 604 deletions

1
.gitattributes vendored
View File

@@ -1 +0,0 @@
public/* linguist-vendored

View File

@@ -7,17 +7,16 @@ gem 'jquery-rails'
gem 'bcrypt' # To use ActiveModel's has_secure_password gem 'bcrypt' # To use ActiveModel's has_secure_password
gem 'sanitize' gem 'sanitize'
gem 'strip_attributes' gem 'strip_attributes'
gem 'redcarpet' gem 'redcarpet', '~> 3.2.3'
gem 'hirb' # pretty console output gem 'hirb' # pretty console output
gem 'rb-readline' gem 'rb-readline'
gem 'rest-client' gem 'rest-client'
gem 'activerecord-session_store' gem 'activerecord-session_store'
gem 'highlight_js-rails', github: 'RedstonerServer/highlight_js-rails' gem 'highlight_js-rails', github: 'RedstonerServer/highlight_js-rails'
gem 'kaminari', github: 'jomo/kaminari', branch: 'patch-2' # pagination gem 'kaminari', github: 'jomo/kaminari', branch: 'patch-2' # pagination
gem 'jquery-textcomplete-rails' # @mentions gem 'jquery-textcomplete-rails', github: 'RedstonerServer/jquery-textcomplete-rails' # @mentions
gem 'actionpack-action_caching', github: 'antulik/actionpack-action_caching', ref: '8c6e52c69315d67437f480da5dce4b7c8737fb32' gem 'actionpack-action_caching', github: 'antulik/actionpack-action_caching', ref: '8c6e52c69315d67437f480da5dce4b7c8737fb32'
gem 'mail-gpg', github: 'jomo/mail-gpg', ref: 'a666b48ee866dfa3eaa700f9c5edf4d195d0f8c9' gem 'mail-gpg', github: 'jomo/mail-gpg', ref: 'a666b48ee866dfa3eaa700f9c5edf4d195d0f8c9'
gem 'totp'
# Gems used only for assets and not required # Gems used only for assets and not required
# in production environments by default. # in production environments by default.

View File

@@ -5,6 +5,15 @@ GIT
highlight_js-rails (8.4) highlight_js-rails (8.4)
rails (>= 3.1.1) rails (>= 3.1.1)
GIT
remote: git://github.com/RedstonerServer/jquery-textcomplete-rails.git
revision: 8bf23af2d8fa1c5226c2b6889c7796adfe1f8772
specs:
jquery-textcomplete-rails (0.1.4)
coffee-rails (>= 3.2.0)
railties (>= 3.2.0)
sass-rails (>= 3.2.0)
GIT GIT
remote: git://github.com/antulik/actionpack-action_caching.git remote: git://github.com/antulik/actionpack-action_caching.git
revision: 8c6e52c69315d67437f480da5dce4b7c8737fb32 revision: 8c6e52c69315d67437f480da5dce4b7c8737fb32
@@ -33,224 +42,202 @@ GIT
GIT GIT
remote: git://github.com/rails/rails.git remote: git://github.com/rails/rails.git
revision: 22aec58a2565a76e0f55d05d045b7a45715c5bb9 revision: 2c8f567e53580872d8c6dfe61201e58793ca131e
branch: 4-2-stable branch: 4-2-stable
specs: specs:
actionmailer (4.2.10) actionmailer (4.2.5.1)
actionpack (= 4.2.10) actionpack (= 4.2.5.1)
actionview (= 4.2.10) actionview (= 4.2.5.1)
activejob (= 4.2.10) activejob (= 4.2.5.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.10) actionpack (4.2.5.1)
actionview (= 4.2.10) actionview (= 4.2.5.1)
activesupport (= 4.2.10) activesupport (= 4.2.5.1)
rack (~> 1.6) rack (~> 1.6)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.10) actionview (4.2.5.1)
activesupport (= 4.2.10) activesupport (= 4.2.5.1)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3) rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.10) activejob (4.2.5.1)
activesupport (= 4.2.10) activesupport (= 4.2.5.1)
globalid (>= 0.3.0) globalid (>= 0.3.0)
activemodel (4.2.10) activemodel (4.2.5.1)
activesupport (= 4.2.10) activesupport (= 4.2.5.1)
builder (~> 3.1) builder (~> 3.1)
activerecord (4.2.10) activerecord (4.2.5.1)
activemodel (= 4.2.10) activemodel (= 4.2.5.1)
activesupport (= 4.2.10) activesupport (= 4.2.5.1)
arel (~> 6.0) arel (~> 6.0)
activesupport (4.2.10) activesupport (4.2.5.1)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
rails (4.2.10) rails (4.2.5.1)
actionmailer (= 4.2.10) actionmailer (= 4.2.5.1)
actionpack (= 4.2.10) actionpack (= 4.2.5.1)
actionview (= 4.2.10) actionview (= 4.2.5.1)
activejob (= 4.2.10) activejob (= 4.2.5.1)
activemodel (= 4.2.10) activemodel (= 4.2.5.1)
activerecord (= 4.2.10) activerecord (= 4.2.5.1)
activesupport (= 4.2.10) activesupport (= 4.2.5.1)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.10) railties (= 4.2.5.1)
sprockets-rails sprockets-rails
railties (4.2.10) railties (4.2.5.1)
actionpack (= 4.2.10) actionpack (= 4.2.5.1)
activesupport (= 4.2.10) activesupport (= 4.2.5.1)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
activerecord-session_store (1.1.1) activerecord-session_store (0.1.2)
actionpack (>= 4.0) actionpack (>= 4.0.0, < 5)
activerecord (>= 4.0) activerecord (>= 4.0.0, < 5)
multi_json (~> 1.11, >= 1.11.2) railties (>= 4.0.0, < 5)
rack (>= 1.5.2, < 3) arel (6.0.3)
railties (>= 4.0) bcrypt (3.1.10)
airbrussh (1.3.1) better_errors (2.1.1)
sshkit (>= 1.6.1, != 1.7.0)
arel (6.0.4)
base32 (0.3.2)
bcrypt (3.1.12)
better_errors (2.5.0)
coderay (>= 1.0.0) coderay (>= 1.0.0)
erubi (>= 1.0.0) erubis (>= 2.6.6)
rack (>= 0.9.0) rack (>= 0.9.0)
binding_of_caller (0.8.0) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
builder (3.2.3) builder (3.2.2)
capistrano (3.11.0) capistrano (3.4.0)
airbrussh (>= 1.0.0)
i18n i18n
rake (>= 10.0.0) rake (>= 10.0.0)
sshkit (>= 1.9.0) sshkit (~> 1.3)
capistrano-bundler (1.1.4) capistrano-bundler (1.1.4)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.2) sshkit (~> 1.2)
capistrano-rails (1.1.8) capistrano-rails (1.1.6)
capistrano (~> 3.1) capistrano (~> 3.1)
capistrano-bundler (~> 1.1) capistrano-bundler (~> 1.1)
capistrano-rbenv (2.1.4) capistrano-rbenv (2.0.4)
capistrano (~> 3.1) capistrano (~> 3.1)
sshkit (~> 1.3) sshkit (~> 1.3)
choice (0.2.0) choice (0.2.0)
coderay (1.1.2) coderay (1.1.0)
coffee-rails (4.2.2) coffee-rails (4.1.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0) railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1) coffee-script (2.4.1)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.12.2) coffee-script-source (1.10.0)
concurrent-ruby (1.1.3) concurrent-ruby (1.0.0)
crass (1.0.4) crass (1.0.2)
debug_inspector (0.0.3) debug_inspector (0.0.2)
domain_name (0.5.20180417) domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
erubi (1.7.1)
erubis (2.7.0) erubis (2.7.0)
execjs (2.7.0) execjs (2.6.0)
ffi (1.9.25) globalid (0.3.6)
globalid (0.4.1) activesupport (>= 4.1.0)
activesupport (>= 4.2.0) gpgme (2.0.11)
gpgme (2.0.16) mini_portile (>= 0.5.0)
mini_portile2 (~> 2.3)
hirb (0.7.3) hirb (0.7.3)
http-cookie (1.0.3) http-cookie (1.0.2)
domain_name (~> 0.5) domain_name (~> 0.5)
i18n (0.9.5) i18n (0.7.0)
concurrent-ruby (~> 1.0) jquery-rails (4.1.0)
jquery-rails (4.3.3) rails-dom-testing (~> 1.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
jquery-textcomplete-rails (0.1.5) json (1.8.3)
coffee-rails (>= 3.2.0) kgio (2.10.0)
railties (>= 3.2.0) loofah (2.0.3)
sass-rails (>= 3.2.0)
kgio (2.11.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.1) mail (2.6.3)
mini_mime (>= 0.1.1) mime-types (>= 1.16, < 3)
mime-types (3.2.2) mime-types (2.99)
mime-types-data (~> 3.2015) mini_portile (0.6.2)
mime-types-data (3.2018.0812) mini_portile2 (2.0.0)
mini_mime (1.0.1) minitest (5.8.4)
mini_portile2 (2.3.0) mysql2 (0.4.2)
minitest (5.11.3)
multi_json (1.13.1)
mysql2 (0.5.2)
net-scp (1.2.1) net-scp (1.2.1)
net-ssh (>= 2.6.5) net-ssh (>= 2.6.5)
net-ssh (5.0.2) net-ssh (3.0.2)
netrc (0.11.0) netrc (0.11.0)
nokogiri (1.8.5) nokogiri (1.6.7.2)
mini_portile2 (~> 2.3.0) mini_portile2 (~> 2.0.0.rc2)
nokogumbo (2.0.1) nokogumbo (1.4.7)
nokogiri (~> 1.8, >= 1.8.4) nokogiri
rack (1.6.11) rack (1.6.4)
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.9) rails-dom-testing (1.0.7)
activesupport (>= 4.2.0, < 5.0) activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6) nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1) rails-deprecated_sanitizer (>= 1.0.1)
rails-erd (1.5.2) rails-erd (1.4.5)
activerecord (>= 3.2) activerecord (>= 3.2)
activesupport (>= 3.2) activesupport (>= 3.2)
choice (~> 0.2.0) choice (~> 0.2.0)
ruby-graphviz (~> 1.2) ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.0.4) rails-html-sanitizer (1.0.3)
loofah (~> 2.2, >= 2.2.2) loofah (~> 2.0)
raindrops (0.19.0) raindrops (0.15.0)
rake (12.3.2) rake (10.5.0)
rb-fsevent (0.10.3) rb-readline (0.5.3)
rb-inotify (0.9.10) redcarpet (3.2.3)
ffi (>= 0.5.0, < 2) rest-client (1.8.0)
rb-readline (0.5.5)
redcarpet (3.4.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0) mime-types (>= 1.16, < 3.0)
netrc (~> 0.8) netrc (~> 0.7)
ruby-graphviz (1.2.4) ruby-graphviz (1.2.2)
sanitize (5.0.0) sanitize (4.0.1)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.8.0) nokogiri (>= 1.4.4)
nokogumbo (~> 2.0) nokogumbo (~> 1.4.1)
sass (3.7.2) sass (3.4.21)
sass-listen (~> 4.0.0) sass-rails (5.0.4)
sass-listen (4.0.0) railties (>= 4.0.0, < 5.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3) tilt (>= 1.1, < 3)
sprockets (3.7.2) sprockets (3.5.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.2.1) sprockets-rails (3.0.0)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.3.13) sqlite3 (1.3.11)
sshkit (1.18.0) sshkit (1.8.1)
net-scp (>= 1.1.2) net-scp (>= 1.1.2)
net-ssh (>= 2.8.0) net-ssh (>= 2.8.0)
strip_attributes (1.8.0) strip_attributes (1.7.1)
activemodel (>= 3.0, < 6.0) activemodel (>= 3.0, < 5.0)
thor (0.20.3) thor (0.19.1)
thread_safe (0.3.6) thread_safe (0.3.5)
tilt (2.0.8) tilt (2.0.2)
totp (1.0.0) tzinfo (1.2.2)
base32
tzinfo (1.2.5)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (4.1.20) uglifier (2.7.2)
execjs (>= 0.3.0, < 3) execjs (>= 0.3.0)
json (>= 1.8.0)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.5) unf_ext (0.0.7.1)
unicorn (5.4.1) unicorn (5.0.1)
kgio (~> 2.6) kgio (~> 2.6)
rack
raindrops (~> 0.7) raindrops (~> 0.7)
webrick (1.4.2) webrick (1.3.1)
PLATFORMS PLATFORMS
ruby ruby
@@ -267,24 +254,23 @@ DEPENDENCIES
highlight_js-rails! highlight_js-rails!
hirb hirb
jquery-rails jquery-rails
jquery-textcomplete-rails jquery-textcomplete-rails!
kaminari! kaminari!
mail-gpg! mail-gpg!
mysql2 mysql2
rails! rails!
rails-erd rails-erd
rb-readline rb-readline
redcarpet redcarpet (~> 3.2.3)
rest-client rest-client
sanitize sanitize
sass-rails sass-rails
sqlite3 sqlite3
strip_attributes strip_attributes
totp
tzinfo-data tzinfo-data
uglifier uglifier
unicorn unicorn
webrick webrick
BUNDLED WITH BUNDLED WITH
1.17.3 1.11.2

View File

@@ -1,116 +0,0 @@
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific
works ("Commons") that the public can reliably and without fear of later
claims of infringement build upon, modify, incorporate in other works, reuse
and redistribute as freely as possible in any form whatsoever and for any
purposes, including without limitation commercial purposes. These owners may
contribute to the Commons to promote the ideal of a free culture and the
further production of creative, cultural and scientific works, or to gain
reputation or greater distribution for their Work in part through the use and
efforts of others.
For these and/or other purposes and motivations, and without any expectation
of additional consideration or compensation, the person associating CC0 with a
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
and publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not limited
to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
the Waiver for the benefit of each member of the public at large and to the
detriment of Affirmer's heirs and successors, fully intending that such Waiver
shall not be subject to revocation, rescission, cancellation, termination, or
any other legal or equitable action to disrupt the quiet enjoyment of the Work
by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
is so judged Affirmer hereby grants to each affected person a royalty-free,
non transferable, non sublicensable, non exclusive, irrevocable and
unconditional license to exercise Affirmer's Copyright and Related Rights in
the Work (i) in all territories worldwide, (ii) for the maximum duration
provided by applicable law or treaty (including future time extensions), (iii)
in any current or future medium and for any number of copies, and (iv) for any
purpose whatsoever, including without limitation commercial, advertising or
promotional purposes (the "License"). The License shall be deemed effective as
of the date CC0 was applied by Affirmer to the Work. Should any part of the
License for any reason be judged legally invalid or ineffective under
applicable law, such partial invalidity or ineffectiveness shall not
invalidate the remainder of the License, and in such case Affirmer hereby
affirms that he or she will not (i) exercise any of his or her remaining
Copyright and Related Rights in the Work or (ii) assert any associated claims
and causes of action with respect to the Work, in either case contrary to
Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or otherwise,
including without limitation warranties of title, merchantability, fitness
for a particular purpose, non infringement, or the absence of latent or
other defects, accuracy, or the present or absence of errors, whether or not
discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without limitation
any person's Copyright and Related Rights in the Work. Further, Affirmer
disclaims responsibility for obtaining any necessary consents, permissions
or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
<http://creativecommons.org/publicdomain/zero/1.0/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 315 B

View File

@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base class ApplicationController < ActionController::Base
protect_from_forgery protect_from_forgery
before_filter :update_ip, :update_seen, :check_banned, :check_2fa before_filter :update_ip, :update_seen, :check_banned
# TODO: use SSL # TODO: use SSL
@@ -41,14 +41,6 @@ class ApplicationController < ActionController::Base
end end
end end
def check_2fa
# Over complicated way of asking if the user is logged in as a mod without TOTP enabled while they are not on their login settings screen, logging out, or updating their login settings.
if current_user && current_user.mod? && !current_user.totp_enabled? && !(controller_name == "users" && action_name == "edit_login") && !(controller_name == "sessions" && action_name == "destroy") && !(controller_name == "users" && action_name == "update_login")
flash[:alert] = "Due to your staff rank, you are required to enable 2FA."
redirect_to :controller => "users", :action => "edit_login", :id => current_user.id
end
end
#roles #roles
def disabled? def disabled?

View File

@@ -69,7 +69,7 @@ class BlogpostsController < ApplicationController
end end
def auth def auth
unless mod? unless mod? && current_user.confirmed?
flash[:alert] = "You are not allowed to edit posts!" flash[:alert] = "You are not allowed to edit posts!"
redirect_to @post ? @post : blogposts_path redirect_to @post ? @post : blogposts_path
end end

View File

@@ -17,7 +17,7 @@ class ForumgroupsController < ApplicationController
end end
def update def update
if admin? if admin? && current_user.confirmed?
@group = Forumgroup.find(params[:id]) @group = Forumgroup.find(params[:id])
if @group.update_attributes(group_params) if @group.update_attributes(group_params)
flash[:notice] = "Forum group updated" flash[:notice] = "Forum group updated"
@@ -41,7 +41,7 @@ class ForumgroupsController < ApplicationController
end end
def create def create
if admin? if admin? && current_user.confirmed?
@group = Forumgroup.new(group_params) @group = Forumgroup.new(group_params)
if @group.save if @group.save
flash[:notice] = "Forum group created." flash[:notice] = "Forum group created."
@@ -57,7 +57,7 @@ class ForumgroupsController < ApplicationController
end end
def destroy def destroy
if admin? if admin? && current_user.confirmed?
@group = Forumgroup.find(params[:id]) @group = Forumgroup.find(params[:id])
if @group.destroy if @group.destroy
flash[:notice] = "forum group deleted." flash[:notice] = "forum group deleted."

View File

@@ -34,7 +34,7 @@ class ForumsController < ApplicationController
end end
def update def update
if admin? if admin? && current_user.confirmed?
if @forum.update_attributes(forum_params) if @forum.update_attributes(forum_params)
flash[:notice] = "Forum updated" flash[:notice] = "Forum updated"
redirect_to @forum redirect_to @forum
@@ -48,7 +48,7 @@ class ForumsController < ApplicationController
end end
def create def create
if admin? if admin? && current_user.confirmed?
@forum = Forum.new(forum_params([:forumgroup_id])) @forum = Forum.new(forum_params([:forumgroup_id]))
if @forum.save if @forum.save
flash[:notice] = "Forum created." flash[:notice] = "Forum created."
@@ -64,7 +64,7 @@ class ForumsController < ApplicationController
end end
def destroy def destroy
if admin? if admin? && current_user.confirmed?
if @forum.destroy if @forum.destroy
flash[:notice] = "Forum deleted." flash[:notice] = "Forum deleted."
else else
@@ -89,7 +89,7 @@ class ForumsController < ApplicationController
end end
def forum_params(add = []) def forum_params(add = [])
a = [:name, :position, :role_read_id, :role_write_id, :necro_length, :disable_deletion] + add a = [:name, :position, :role_read_id, :role_write_id, :necro_length] + add
params.require(:forum).permit(a) params.require(:forum).permit(a)
end end
end end

View File

@@ -10,7 +10,6 @@ class ForumthreadsController < ApplicationController
@threads = Forumthread.filter(current_user, params[:title].try(:slice, 0..255), params[:content].try(:slice, 0..255), params[:reply].try(:slice, 0..255), params[:label], User.find_by(ign: params[:author].to_s.strip) || params[:author], params[:query].try(:slice, 0..255), Forum.find_by(id: params[:forum])) @threads = Forumthread.filter(current_user, params[:title].try(:slice, 0..255), params[:content].try(:slice, 0..255), params[:reply].try(:slice, 0..255), params[:label], User.find_by(ign: params[:author].to_s.strip) || params[:author], params[:query].try(:slice, 0..255), Forum.find_by(id: params[:forum]))
.page(params[:page]).per(30) .page(params[:page]).per(30)
end end
def show def show
if params[:reverse] == "true" if params[:reverse] == "true"
@replies = @thread.replies.order(id: :desc).page(params[:page]) @replies = @thread.replies.order(id: :desc).page(params[:page])
@@ -73,7 +72,7 @@ class ForumthreadsController < ApplicationController
end end
def destroy def destroy
if mod? || (@thread.author.is?(current_user) && !@thread.forum.disable_deletion) if mod? || @thread.author.is?(current_user)
if @thread.destroy if @thread.destroy
flash[:notice] = "Thread deleted!" flash[:notice] = "Thread deleted!"
else else

View File

@@ -22,9 +22,9 @@ class InfoController < ApplicationController
def create def create
@info = Info.new(info_params) @info = Info.new(info_params)
if @info.save if @info.save
redirect_to @info, notice: 'Info has been created.' redirect_to @info, notice: 'The info page has been created!'
else else
flash[:alert] = "Error creating info" flash[:alert] = "An error occured while creating the info page."
render action: "new" render action: "new"
end end
end end
@@ -32,18 +32,18 @@ class InfoController < ApplicationController
def update def update
@info.attributes = info_params() @info.attributes = info_params()
if @info.save if @info.save
redirect_to @info, notice: 'Info has been updated.' redirect_to @info, notice: 'The info page has been updated!'
else else
flash[:alert] = "There was a problem while updating the info" flash[:alert] = "An error occured while updating the info page."
render action: "edit" render action: "edit"
end end
end end
def destroy def destroy
if @info.destroy if @info.destroy
flash[:notice] = "Info deleted!" flash[:notice] = "The info page has been deleted!"
else else
flash[:alert] = "There was a problem while deleting this info" flash[:alert] = "An error occured while deleting the info page."
end end
redirect_to info_index_path redirect_to info_index_path
end end
@@ -62,9 +62,9 @@ class InfoController < ApplicationController
end end
def auth def auth
unless mod? unless mod? && current_user.confirmed?
flash[:alert] = "You are not allowed to edit info!" flash[:alert] = "You are not allowed to edit info pages!"
redirect_to @info ? @info : info_index_path redirect_to @info ? @info : info_index_path
end end
end end
end end

View File

@@ -21,10 +21,6 @@ class SessionsController < ApplicationController
flash[:alert] = "Your account has been disabled!" flash[:alert] = "Your account has been disabled!"
elsif user.banned? elsif user.banned?
flash[:alert] = "You are banned!" flash[:alert] = "You are banned!"
elsif user.totp_enabled && !TOTP.valid?(user.totp_secret, params[:totp_code].to_i)
flash[:alert] = "You're doing it wrong!"
render action: 'new'
return
else else
session[:user_id] = user.id session[:user_id] = user.id
flash[:notice] = "Logged in!" flash[:notice] = "Logged in!"
@@ -114,4 +110,4 @@ class SessionsController < ApplicationController
redirect_to login_path redirect_to login_path
end end
end end
end end

View File

@@ -20,7 +20,7 @@ class StaticsController < ApplicationController
@players = [] @players = []
@count = 0 @count = 0
begin begin
json = JSON.parse(File.read("/etc/minecraft/info/players.json")) json = JSON.parse(File.read("/etc/minecraft/redstoner/plugins/ModuleLoader/players.json"))
rescue rescue
flash.now[:alert] = "The server is currently offline." flash.now[:alert] = "The server is currently offline."
else else

View File

@@ -17,9 +17,13 @@ class UsersController < ApplicationController
def show def show
begin begin
@ban_json = JSON.parse(File.read("/etc/minecraft/info/banned-players.json")).detect {|u| u["uuid"].tr("-", "") == @user.uuid} @ban_json = JSON.parse(File.read("/etc/minecraft/redstoner/banned-players.json")).detect {|u| u["uuid"].tr("-", "") == @user.uuid}
rescue rescue
flash.now[:alert] = "An error occured while checking if this user is banned from the server!" if @user.is?(current_user)
flash.now[:alert] = "An error occured while checking if you are banned from the server!"
else
flash.now[:alert] = "An error occured while checking if this user is banned from the server!"
end
@ban_json = nil @ban_json = nil
end end
end end
@@ -87,12 +91,6 @@ class UsersController < ApplicationController
@user.uuid = user_profile["id"] @user.uuid = user_profile["id"]
@user.ign = user_profile["name"] # correct case @user.ign = user_profile["name"] # correct case
if User.find_by(uuid: @user.uuid)
flash[:alert] = "You already have a Redstoner account associated with this Minecraft account. Please log in instead."
redirect_to login_path
return
end
if validate_token(@user.uuid, @user.email, params[:registration_token]) if validate_token(@user.uuid, @user.email, params[:registration_token])
destroy_token(params[:email]) destroy_token(params[:email])
@user.last_ip = request.remote_ip # showing in mail @user.last_ip = request.remote_ip # showing in mail
@@ -137,7 +135,7 @@ class UsersController < ApplicationController
end end
def resend_mail def resend_mail
if (@user.is?(current_user) || mod?) && !@user.confirmed? if (@user.is?(current_user) || (mod? && current_user.confirmed?)) && !@user.confirmed?
RedstonerMailer.register_mail(@user, false).deliver_now RedstonerMailer.register_mail(@user, false).deliver_now
flash[:notice] = "Check your inbox for the confirmation mail." flash[:notice] = "Check your inbox for the confirmation mail."
else else
@@ -147,11 +145,11 @@ class UsersController < ApplicationController
end end
def update def update
if (mod? && current_user.role >= @user.role ) || (@user.is?(current_user) && confirmed?) if (mod? && current_user.role >= @user.role && current_user.confirmed?) || (@user.is?(current_user) && confirmed?)
if mod? if mod?
userdata = user_params([:name, :discord, :youtube, :twitter, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark]) userdata = user_params([:name, :skype, :youtube, :twitter, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark])
else else
userdata = user_params([:name, :discord, :youtube, :twitter, :about, :header_scroll, :utc_time, :dark]) userdata = user_params([:name, :skype, :youtube, :twitter, :about, :header_scroll, :utc_time, :dark])
end end
if User.find_by(name: userdata[:name]) && User.find_by(name: userdata[:name]) != @user if User.find_by(name: userdata[:name]) && User.find_by(name: userdata[:name]) != @user
flash[:alert] = "You have entered a name that belongs to someone else. Please try another." flash[:alert] = "You have entered a name that belongs to someone else. Please try another."
@@ -190,7 +188,7 @@ class UsersController < ApplicationController
end end
def ban def ban
if mod? && current_user.role >= @user.role if mod? && current_user.role >= @user.role && current_user.confirmed?
@user.role = Role.get :banned @user.role = Role.get :banned
flash[:notice] = "'#{@user.name}' has been banned!" flash[:notice] = "'#{@user.name}' has been banned!"
else else
@@ -200,7 +198,7 @@ class UsersController < ApplicationController
end end
def unban def unban
if mod? && current_user.role >= @user.role if mod? && current_user.role >= @user.role && current_user.confirmed?
@user.role = Role.get :normal @user.role = Role.get :normal
flash[:notice] = "\"#{@user.name}\" has been unbanned!" flash[:notice] = "\"#{@user.name}\" has been unbanned!"
else else
@@ -210,7 +208,7 @@ class UsersController < ApplicationController
end end
def destroy def destroy
if superadmin? if superadmin? && current_user.confirmed?
if @user.destroy if @user.destroy
flash[:notice] = "User deleted forever." flash[:notice] = "User deleted forever."
redirect_to users_url redirect_to users_url
@@ -225,33 +223,28 @@ class UsersController < ApplicationController
end end
def edit_notifications def edit_notifications
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin? unless @user.is?(current_user) || (admin? && current_user.role > @user.role) || superadmin?
flash[:alert] = "You are not allowed to edit this user's notification settings!" flash[:alert] = "You are not allowed to edit this user's notification settings!"
redirect_to @user redirect_to @user
end end
end end
def edit_login def edit_login
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin? unless @user.is?(current_user) || (admin? && current_user.role > @user.role) || superadmin?
flash[:alert] = "You are not allowed to edit this user's login details!" flash[:alert] = "You are not allowed to edit this user's login details!"
redirect_to @user redirect_to @user
return
end
if !@user.totp_enabled
@user.update(totp_secret: TOTP.secret)
end end
end end
def edit_website_settings def edit_website_settings
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin? unless @user.is?(current_user) || (admin? && current_user.role > @user.role) || superadmin?
flash[:alert] = "You are not allowed to edit this user's website settings!" flash[:alert] = "You are not allowed to edit this user's website settings!"
redirect_to @user redirect_to @user
end end
end end
def update_login def update_login
if @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin? if @user.is?(current_user) || (admin? && current_user.role > @user.role && current_user.confirmed?) || (superadmin? && current_user.confirmed?)
authenticated = !@user.is?(current_user) || @user.authenticate(params[:current_password]) authenticated = !@user.is?(current_user) || @user.authenticate(params[:current_password])
if params[:user][:password].present? if params[:user][:password].present?
@user.password = params[:user][:password] @user.password = params[:user][:password]
@@ -262,18 +255,6 @@ class UsersController < ApplicationController
@user.email_token = SecureRandom.hex(16) if mail_changed @user.email_token = SecureRandom.hex(16) if mail_changed
@user.confirmed = !mail_changed @user.confirmed = !mail_changed
if params[:user][:totp_enabled] == "1" && !@user.totp_enabled
if TOTP.valid?(@user.totp_secret, params[:totp_code].to_i)
@user.totp_enabled = true
else
flash[:alert] = "Wrong TOTP code!"
render action: "edit_login"
return
end
elsif params[:user][:totp_enabled] == "0" && @user.totp_enabled
@user.totp_enabled = false
end
# checking here for password so we can send back changes to the view # checking here for password so we can send back changes to the view
if authenticated if authenticated
if @user.save if @user.save
@@ -381,7 +362,7 @@ class UsersController < ApplicationController
end end
def user_params(add = []) def user_params(add = [])
a = [:ign, :email, :password, :password_confirmation, :mail_own_thread_reply, :mail_other_thread_reply, :mail_own_blogpost_comment, :mail_other_blogpost_comment, :mail_mention, :public_key, :totp_code] + add a = [:ign, :email, :password, :password_confirmation, :mail_own_thread_reply, :mail_other_thread_reply, :mail_own_blogpost_comment, :mail_other_blogpost_comment, :mail_mention, :public_key] + add
params.require(:user).permit(a) params.require(:user).permit(a)
end end
end end

View File

@@ -51,4 +51,5 @@ module UsersHelper
return nil return nil
end end
end end
end end

View File

@@ -1,8 +1,8 @@
class RedstonerMailer < ActionMailer::Base class RedstonerMailer < ActionMailer::Base
add_template_helper(ApplicationHelper) add_template_helper(ApplicationHelper)
default from: "\"Redstoner\" <noreply@redstoner.com>" default from: "info@redstoner.com"
default reply_to: "staff@redstoner.com" default reply_to: "redstonerserver+website@gmail.com"
def register_mail(user, uses_mc_pass) def register_mail(user, uses_mc_pass)
@user = user @user = user

View File

@@ -21,7 +21,6 @@ class User < ActiveRecord::Base
validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[(IPv6)?[0-9a-f:.]+\])\z/i, message: "That doesn't look like an email address."} validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[(IPv6)?[0-9a-f:.]+\])\z/i, message: "That doesn't look like an email address."}
validates :ign, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z\d_]+\z/i, message: "Username is invalid (a-z, 0-9, _)."} validates :ign, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z\d_]+\z/i, message: "Username is invalid (a-z, 0-9, _)."}
validates :discord, uniqueness: {case_sensitive: false}, format: {with: /\A^(?!everyone|here|discordtag|.*```.*)([^@#:]{2,32}#[0-9]{4})$\z/i, message: "Discord name is invalid."}, allow_blank: true
validates :public_key, format: {with: /\A(-----BEGIN PGP PUBLIC KEY BLOCK-----((.|\n)*?)-----END PGP PUBLIC KEY BLOCK-----)?\z/i, message: "That doesn't look like a PGP formatted public key."} validates :public_key, format: {with: /\A(-----BEGIN PGP PUBLIC KEY BLOCK-----((.|\n)*?)-----END PGP PUBLIC KEY BLOCK-----)?\z/i, message: "That doesn't look like a PGP formatted public key."}
@@ -169,7 +168,7 @@ class User < ActiveRecord::Base
self.ign.strip! if self.ign self.ign.strip! if self.ign
self.email.strip! if self.email self.email.strip! if self.email
self.about.strip! if self.about self.about.strip! if self.about
self.discord.strip! if self.discord self.skype.strip! if self.skype
self.youtube.strip! if self.youtube self.youtube.strip! if self.youtube
self.twitter.strip! if self.twitter self.twitter.strip! if self.twitter
end end

View File

@@ -1,10 +1,20 @@
<% title "Edit Post: #{@post.title}" %> <% title "Edit News: #{@post.title}" %>
<h1>Edit Post: #{@post.title}</h1> <%
def can_edit?
mod? && current_user.confirmed?
end
%>
<h1>Edit post</h1>
<%= form_for @post do |f|%> <%= form_for @post do |f|%>
<%= f.text_field :title %> <%= f.text_field :title, disabled: !can_edit? %>
<%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content} %> <%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content, options: {disabled: !can_edit?}} %>
<p><%= f.submit "Update Post", class: "btn blue left" %></p> <p><%= f.submit "Update Post", class: "btn blue left", disabled: !can_edit? %></p>
<% end %> <% end %>
<p><%= button_to "Delete Post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right" %></p> <p><%= button_to "Delete post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right", disabled: !can_edit? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !current_user.confirmed? %>
<span class='red-alert'>You must confirm your email before you can edit blog posts.</span>
<% end %>

View File

@@ -1,7 +1,7 @@
<% title "News" %> <% title "News" %>
<h1>News</h1> <h1>News</h1>
<%= link_to 'New Post', new_blogpost_path, class: "btn blue" if mod? %> <%= link_to 'Make new Post', new_blogpost_path, class: "btn blue" if mod? %>
<div id="posts"> <div id="posts">
<% @posts.each do |p| %> <% @posts.each do |p| %>
<div class="item-group with-avatar" id="post-<%= p.id %>"> <div class="item-group with-avatar" id="post-<%= p.id %>">

View File

@@ -1,9 +1,19 @@
<% title "New Blog Post" %> <% title "New Blog Post" %>
<%
def can_create?
admin? && current_user.confirmed?
end
%>
<h1>New Post</h1> <h1>New Post</h1>
<%= form_for @post do |f|%> <%= form_for @post do |f|%>
<%= f.text_field :title, placeholder: "Title" %> <%= f.text_field :title, placeholder: "Title", disabled: !can_create? %>
<%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content} %> <%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content, options: {disabled: !can_create?}} %>
<p><%= f.submit "Create Post", class: "btn blue left" %></p> <p><%= f.submit "Create Post", class: "btn blue left", disabled: !can_create? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !current_user.confirmed? %>
<span class='red-alert'>You must confirm your email before you can create new blog posts.</span>
<% end %>
<% end %> <% end %>

View File

@@ -1,5 +1,5 @@
<h3>New Comment</h3> <h3>New comment</h3>
<%= form_for [@post, @comment] do |f| %> <%= form_for [@post, @comment] do |f| %>
<%= render partial: "md_editor", locals: {name: "comment[content]", content: @comment.content} %> <%= render partial: "md_editor", locals: {name: "comment[content]", content: @comment.content} %>
<p><%= f.submit class: "btn blue" %></p> <p><%= f.submit class: "btn blue" %></p>
<% end %> <% end %>

View File

@@ -1,10 +1,10 @@
<% title "Edit Comment: #{@comment.blogpost.title}" %> <% title "Edit Comment: #{@comment.blogpost.title}" %>
<h1>Edit Comment</h1> <h1>Edit comment</h1>
<%= form_for [@comment.blogpost, @comment] do |f| %> <%= form_for [@comment.blogpost, @comment] do |f| %>
<%= render partial: "md_editor", locals: {name: "comment[content]", content: @comment.content} %> <%= render partial: "md_editor", locals: {name: "comment[content]", content: @comment.content} %>
<p><%= f.submit "Update Comment", class: "btn blue left" %></p> <p><%= f.submit "Update Comment", class: "btn blue left" %></p>
<% end %> <% end %>
<p><%= button_to "Delete Comment", [@comment.blogpost, @comment] , method: "delete", data: {confirm: "Delete comment forever?"}, class: "btn red right" %></p> <p><%= button_to "Delete comment", [@comment.blogpost, @comment] , method: "delete", data: {confirm: "Delete comment forever?"}, class: "btn red right" %></p>
<div class="clear"></div> <div class="clear"></div>

View File

@@ -1,5 +1,11 @@
<% title "Manage Forums" %> <% title "Manage Forums" %>
<%
def can_edit?
admin? && current_user.confirmed?
end
%>
<h1>Manage Forums</h1> <h1>Manage Forums</h1>
<div class="item-group"> <div class="item-group">
<div class="header"> <div class="header">
@@ -19,22 +25,26 @@
<table> <table>
<tr> <tr>
<td><%= f.label :name %></td> <td><%= f.label :name %></td>
<td><%= f.text_field :name, placeholder: "Name" %></td> <td><%= f.text_field :name, placeholder: "Name", disabled: !can_edit? %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :position %></td> <td><%= f.label :position %></td>
<td><%= f.number_field :position, placeholder: "Position" %></td> <td><%= f.number_field :position, placeholder: "Position", disabled: !can_edit? %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :role_read_id, "Min. read role" %></td> <td><%= f.label :role_read_id, "Min. read role" %></td>
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td> <td><%= f.select :role_read_id, role_selection, { include_blank: "None" }, { disabled: !can_edit? } %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :role_write_id, "Min. write role" %></td> <td><%= f.label :role_write_id, "Min. write role" %></td>
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td> <td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_edit? } %></td>
</tr> </tr>
</table> </table>
<p><%= f.submit "Update Group", class: "btn blue left" %></p> <p><%= f.submit "Update group", class: "btn blue left", disabled: !can_edit? %></p>
<% end %> <% end %>
<p><%= button_to "Delete Group", @group, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not be accessible!"}, class: "btn red right" %></p> <p><%= button_to "Delete group", @group, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not be accessible!"}, class: "btn red right", disabled: !can_edit? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !current_user.confirmed? %>
<span class='red-alert'>You must confirm your email before you can edit forum groups.</span>
<% end %>

View File

@@ -1,26 +1,36 @@
<% title "New Forum: #{@group.name}" %> <% title "New Forum: #{@group.name}" %>
<h1>New Forum Group</h1> <%
def can_create?
admin? && current_user.confirmed?
end
%>
<h1>New forum group</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %> <% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
<%= form_for @group do |f|%> <%= form_for @group do |f|%>
<table> <table>
<tr> <tr>
<td><%= f.label :name %></td> <td><%= f.label :name %></td>
<td><%= f.text_field :name, placeholder: "Name" %></td> <td><%= f.text_field :name, placeholder: "Name", disabled: !can_create? %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :position %></td> <td><%= f.label :position %></td>
<td><%= f.number_field :position, placeholder: "Position" %></td> <td><%= f.number_field :position, placeholder: "Position", disabled: !can_create? %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :role_read_id, "Min. read role" %></td> <td><%= f.label :role_read_id, "Min. read role" %></td>
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td> <td><%= f.select :role_read_id, role_selection, { include_blank: "None" }, { disabled: !can_create? } %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :role_write_id, "Min. write role" %></td> <td><%= f.label :role_write_id, "Min. write role" %></td>
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td> <td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_create? } %></td>
</tr> </tr>
</table> </table>
<p><%= f.submit "Create Group", class: "btn blue left" %></p> <p><%= f.submit "Create group", class: "btn blue left", disabled: !can_create? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !current_user.confirmed? %>
<span class='red-alert'>You must confirm your email before you can create new forum groups.</span>
<% end %>
<% end %> <% end %>

View File

@@ -1,5 +1,11 @@
<% title "Edit Forum: #{@forum.name}" %> <% title "Edit Forum: #{@forum.name}" %>
<%
def can_edit?
admin? && current_user.confirmed?
end
%>
<%= link_to "(Edit) #{@forum.group.name}", edit_forumgroup_path(@forum.group) %> → <%= @forum.name %> <%= link_to "(Edit) #{@forum.group.name}", edit_forumgroup_path(@forum.group) %> → <%= @forum.name %>
<h1>Edit Forum</h1> <h1>Edit Forum</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %> <% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
@@ -7,30 +13,30 @@
<table> <table>
<tr> <tr>
<td><%= f.label :name %></td> <td><%= f.label :name %></td>
<td><%= f.text_field :name, placeholder: "Name" %></td> <td><%= f.text_field :name, placeholder: "Name", disabled: !can_edit? %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :position %></td> <td><%= f.label :position %></td>
<td><%= f.number_field :position, placeholder: "Position" %></td> <td><%= f.number_field :position, placeholder: "Position", disabled: !can_edit? %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :role_read_id, "Min. read role" %></td> <td><%= f.label :role_read_id, "Min. read role" %></td>
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td> <td><%= f.select :role_read_id, role_selection, { include_blank: "None" }, { disabled: !can_edit? } %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :role_write_id, "Min. write role" %></td> <td><%= f.label :role_write_id, "Min. write role" %></td>
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td> <td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_edit? } %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td> <td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td> <td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)", disabled: !can_edit? %></td>
</tr>
<tr>
<td><%= f.label :disable_deletion, "Disable deletion of threads for non-staff" %></td>
<td><%= f.check_box :disable_deletion %></td>
</tr> </tr>
</table> </table>
<p><%= f.submit "Update Forum", class: "btn blue left" %></p> <p><%= f.submit "Update forum", class: "btn blue left", disabled: !can_edit? %></p>
<% end %> <% end %>
<p><%= button_to "Delete Forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right" %></p> <p><%= button_to "Delete forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right", disabled: !can_edit? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !current_user.confirmed? %>
<span class='red-alert'>You must confirm your email before you can edit forums.</span>
<% end %>

View File

@@ -1,6 +1,6 @@
<% title "Forums" %> <% title "Forums" %>
<%= link_to "Search All Threads", forumthreads_path, class: "btn blue right" %> <%= link_to "All threads", forumthreads_path, class: "btn blue right" %>
<br> <br>
<div id="forum_groups"> <div id="forum_groups">
<% @groups.each do |group| %> <% @groups.each do |group| %>
@@ -56,6 +56,4 @@
<% if admin? %> <% if admin? %>
<%= link_to "New group", new_forumgroup_path, class: "btn blue" %> <%= link_to "New group", new_forumgroup_path, class: "btn blue" %>
<% elsif mod? %>
<%= link_to "New group", "#", class: "btn blue", disabled: true %>
<% end %> <% end %>

View File

@@ -1,5 +1,11 @@
<% title "New Forum: #{@forum.group.name}" %> <% title "New Forum: #{@forum.group.name}" %>
<%
def can_create?
admin? && current_user.confirmed?
end
%>
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → New forum <%= link_to @forum.group, forumgroup_path(@forum.group) %> → New forum
<h1>New Forum</h1> <h1>New Forum</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %> <% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
@@ -7,30 +13,30 @@
<table> <table>
<tr> <tr>
<td><%= f.label :name %></td> <td><%= f.label :name %></td>
<td><%= f.text_field :name, placeholder: "Name" %></td> <td><%= f.text_field :name, placeholder: "Name", disabled: !can_create? %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :position %></td> <td><%= f.label :position %></td>
<td><%= f.number_field :position, placeholder: "Position" %></td> <td><%= f.number_field :position, placeholder: "Position", disabled: !can_create? %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :role_read_id, "Min. read role" %></td> <td><%= f.label :role_read_id, "Min. read role" %></td>
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td> <td><%= f.select :role_read_id, role_selection, { include_blank: "None"}, { disabled: !can_create? } %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :role_write_id, "Min. write role" %></td> <td><%= f.label :role_write_id, "Min. write role" %></td>
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td> <td><%= f.select :role_write_id, role_selection, { include_blank: false }, { disabled: !can_create? } %></td>
</tr> </tr>
<tr> <tr>
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td> <td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td> <td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)", disabled: !can_create? %></td>
</tr>
<tr>
<td><%= f.label :disable_deletion %></td>
<td><%= f.check_box :disable_deletion %></td>
</tr> </tr>
</table> </table>
<%= f.hidden_field :forumgroup_id %> <%= f.hidden_field :forumgroup_id %>
<p><%= f.submit "Create Forum", class: "btn blue left" %></p> <p><%= f.submit "Create forum", class: "btn blue left", disabled: !can_create? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !current_user.confirmed? %>
<span class='red-alert'>You must confirm your email before you can create new forums.</span>
<% end %>
<% end %> <% end %>

View File

@@ -1,19 +0,0 @@
atom_feed do |feed|
feed.title @forum.name + "'s Latest Threads"
feed.updated Time.now
@threads.limit(10).each do |thread|
unless thread.sticky?
feed.entry thread do |entry|
entry.updated thread.updated_at
entry.author do |a|
a.name thread.author.name
a.uri user_url(thread.author)
end
entry.url forumthread_url(thread)
entry.title thread.title
entry.content render_md(thread.content).html_safe, :type => 'html'
end
end
end
end

View File

@@ -6,7 +6,7 @@
</h1> </h1>
<% if @forum.can_write?(current_user) %> <% if @forum.can_write?(current_user) %>
<p> <p>
<%= link_to "New Thread", new_forumthread_path(forum: @forum), class: "btn blue" %> <%= link_to "New thread", new_forumthread_path(forum: @forum), class: "btn blue" %>
</p> </p>
<% end %> <% end %>

View File

@@ -11,9 +11,7 @@
end end
%> %>
<% forum = Forum.find(@thread.forum_id) %> <h1>Edit thread</h1>
<h1>Edit Thread</h1>
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → <%= link_to @thread, @thread %> → Edit thread <%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → <%= link_to @thread, @thread %> → Edit thread
<%= form_for @thread do |f|%> <%= form_for @thread do |f|%>
<table> <table>
@@ -37,9 +35,7 @@
<%= f.text_field :title, placeholder: "Title" %> <%= f.text_field :title, placeholder: "Title" %>
</div> </div>
<%= render partial: "md_editor", locals: {name: "forumthread[content]", content: @thread.content} %> <%= render partial: "md_editor", locals: {name: "forumthread[content]", content: @thread.content} %>
<p><%= f.submit "Update Thread", class: "btn blue left" %></p> <p><%= f.submit "Update thread", class: "btn blue left" %></p>
<% end %> <% end %>
<% if mod? || !forum.disable_deletion %> <%= button_to "Delete thread", @thread, :method => "delete", data: {confirm: "Delete thread & comments forever?"}, class: "btn red right" %>
<%= button_to "Delete Thread", @thread, :method => "delete", data: {confirm: "Delete thread & comments forever?"}, class: "btn red right" %> <div class="clear"></div>
<% end %>
<div class="clear"></div>

View File

@@ -10,14 +10,14 @@
if params[:forum] if params[:forum]
text = "forum '#{Forum.find(params[:forum]).name}'" text = "forum '#{Forum.find(params[:forum]).name}'"
if params_list.except(:forum).any? if params_list.except(:forum).any?
text = "Search Results in #{text} (#{@threads.total_count})" text = "Search results in #{text} (#{@threads.total_count})"
else else
text = text.capitalize text = text.capitalize
end end
elsif params_list.any? elsif params_list.any?
text = "Search Results (#{@threads.total_count})" text = "Search results (#{@threads.total_count})"
else else
text = "All Threads" text = "All threads"
end end
%> %>
<%= title text %> <%= title text %>

View File

@@ -8,7 +8,7 @@
%> %>
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → New thread <%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → New thread
<h1>New Thread</h1> <h1>New thread</h1>
<%= form_for @thread do |f|%> <%= form_for @thread do |f|%>
<table> <table>
<% if mod? %> <% if mod? %>
@@ -30,6 +30,6 @@
</div> </div>
<%= render partial: "md_editor", locals: {name: "forumthread[content]", content: @thread.content} %> <%= render partial: "md_editor", locals: {name: "forumthread[content]", content: @thread.content} %>
<%= f.hidden_field :forum_id %> <%= f.hidden_field :forum_id %>
<p><%= f.submit "Create Thread", class: "btn blue left" %></p> <p><%= f.submit "Create thread", class: "btn blue left" %></p>
<div class="clear"></div> <div class="clear"></div>
<% end %> <% end %>

View File

@@ -1,10 +1,20 @@
<% title "Edit Info: #{@info.title}" %> <% title "Edit Info: #{@info.title}" %>
<%
def can_edit?
mod? && current_user.confirmed?
end
%>
<h1>Edit Info</h1> <h1>Edit Info</h1>
<%= form_for @info do |f|%> <%= form_for @info do |f|%>
<%= f.text_field :title%> <%= f.text_field :title, disabled: !can_edit? %>
<%= render partial: "md_editor", locals: {name: "info[content]", content: @info.content} %> <%= render partial: "md_editor", locals: {name: "info[content]", content: @info.content, options: {disabled: !can_edit?}} %>
<p><%= f.submit "Update Info", class: "btn blue left" %></p> <p><%= f.submit "Update Info", class: "btn blue left", disabled: !can_edit? %></p>
<% end %>
<p><%= button_to "Delete Info", @info, method: "delete", data: {confirm: "Are you sure you want to delete this info page?"}, class: "btn red right", disabled: !can_edit? %></p>
<div class="clear"></div>
<% if !current_user.confirmed? %>
<span class='red-alert'>You must confirm your email before you can edit info pages.</span>
<% end %> <% end %>
<p><%= button_to "Delete Info", @info, method: "delete", data: {confirm: "Delete Info forever?"}, class: "btn red right" %></p>
<div class="clear"></div>

View File

@@ -1,9 +1,19 @@
<% title "New Info" %> <% title "New Info" %>
<%
def can_create?
mod? && current_user.confirmed?
end
%>
<h1>New Info</h1> <h1>New Info</h1>
<%= form_for @info, url: info_index_path do |f|%> <%= form_for @info, url: info_index_path do |f|%>
<%= f.text_field :title, placeholder: "Title" %> <%= f.text_field :title, placeholder: "Title", disabled: !can_create? %>
<%= render partial: "md_editor", locals: {name: "info[content]", content: @info.content} %> <%= render partial: "md_editor", locals: {name: "info[content]", content: @info.content, options: {disabled: !can_create?}} %>
<p><%= f.submit "Create Info", class: "btn blue left" %></p> <p><%= f.submit "Create Info", class: "btn blue left", disabled: !can_create? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !current_user.confirmed? %>
<span class='red-alert'>You must confirm your email before you can create new info pages.</span>
<% end %>
<% end %> <% end %>

View File

@@ -17,8 +17,13 @@
<%= link_to "https://mstdn.io/@RedstonerServer", title: "Redstoner on Mastodon" do %> <%= link_to "https://mstdn.io/@RedstonerServer", title: "Redstoner on Mastodon" do %>
Mastodon <%= image_tag("mastodon.png") %> Mastodon <%= image_tag("mastodon.png") %>
<% end %> | <% end %> |
<%= link_to "https://discord.gg/QjfcPEJ", title: "Redstoner's Official Discord" do %> <%= link_to "http://rdstnr4biap5nao2.onion", title: "Redstoner over Tor" do %>
Discord <%= image_tag("discord.png") %> Onion Service <%= image_tag("tor.png") %>
<% end %>
<% if current_user %>
| <%= link_to "/slack/?" + {mail: current_user.try(:email)}.to_param do %>
Join us on <img src="/slack/badge.svg" alt="Slack">
<% end %>
<% end %> <% end %>
</div> </div>
</div> </div>

View File

@@ -10,7 +10,7 @@
<% end %> <% end %>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= favicon_link_tag "favicon.ico" %> <%= favicon_link_tag "favicon.ico" %>
<%= javascript_include_tag "https://cdn.jsdelivr.net/gh/jomo/ago.js@0.0.1/ago.min.js", crossorigin: :anonymous, integrity: "sha256-xw0JUUdbuZQCVO+QScoxrlEsD4nZGCjMRh9PP8GLhcY=" %> <%= javascript_include_tag "https://cdn.rawgit.com/jomo/ago.js/v0.0.1/ago.min.js", crossorigin: :anonymous, integrity: "sha256-xw0JUUdbuZQCVO+QScoxrlEsD4nZGCjMRh9PP8GLhcY=" %>
<%= javascript_include_tag "application" %> <%= javascript_include_tag "application" %>
<link type="application/atom+xml" rel="alternate" href="<%= blogposts_path(:atom) %>"> <link type="application/atom+xml" rel="alternate" href="<%= blogposts_path(:atom) %>">
<%= yield(:site_headers) %> <%= yield(:site_headers) %>

View File

@@ -26,7 +26,7 @@
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %> <%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -25,7 +25,7 @@
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %> <%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -22,7 +22,7 @@
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %> <%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -24,7 +24,7 @@
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %> <%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -27,7 +27,7 @@
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %> <%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -38,7 +38,7 @@
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> | <%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %> <%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
</p> </p>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,6 @@
<% title "Log In" %> <% title "Log in" %>
<h1>Log In</h1> <h1>Log in</h1>
<p>Not a member? <%= link_to "Join us", signup_path %>!</p> <p>Not a member? <%= link_to "Join us", signup_path %>!</p>
<%= form_tag login_path do |f| %> <%= form_tag login_path do |f| %>
<table> <table>
@@ -16,14 +16,6 @@
<td></td> <td></td>
<td><%= link_to "Lost your password?", lost_password_users_path %></td> <td><%= link_to "Lost your password?", lost_password_users_path %></td>
</tr> </tr>
<tr>
<td><%= label_tag :totp_code %></td>
<td><%= text_field_tag :totp_code, nil, placeholder: "123456", required: false %></td>
</tr>
<tr>
<td></td>
<td>Leave this field blank if you do not have 2FA enabled.</td>
</tr>
</table> </table>
<p><%= submit_tag "Log in", class: "btn blue" %></p> <p><%= submit_tag "Log in", class: "btn blue" %></p>
<% end %> <% end %>

View File

@@ -19,7 +19,6 @@
<ul> <ul>
<li>The warm feeling of donating for a good thing, plus a huge "<b>thank you</b>"! <li>The warm feeling of donating for a good thing, plus a huge "<b>thank you</b>"!
<li>You can have a nickname. See <%= link_to "our nickname guidelines", info_path("12-nickname-guidelines") %> <li>You can have a nickname. See <%= link_to "our nickname guidelines", info_path("12-nickname-guidelines") %>
<li>You can chat in <font color="red">color</font> in-game.</i>
<li>A "$" next to your name <i>(Including website)</i> <li>A "$" next to your name <i>(Including website)</i>
<li><i>Donator+</i> has access to the in-game command <code>/lol id</code></li> <li><i>Donator+</i> has access to the in-game command <code>/lol id</code></li>
</ul> </ul>
@@ -27,11 +26,11 @@
<div class="donations"> <div class="donations">
<div class="donation"> <div class="donation">
<div class="left"> <div class="left">
<img src="https://crafatar.com/renders/body/d2693e91-93e1-4e3f-929f-f38e1ce8df03?overlay=true&scale=3" alt="sponsor's skin" class="body"> <img src="https://crafatar.com/renders/body/97a4928198f045998e0e7a97eabae6ae?overlay=true&scale=3" alt="sponsor's skin" class="body">
</div> </div>
<div> <div>
<h1>Donate to our server sponsor</h1> <h1>Donate to our server sponsor</h1>
<h4>Pepich1851 pays for the server hardware. You can help him by donating here.</h4> <h4>PotatoKek pays for the server hardware. You can help him by donating here.</h4>
<form target="_blank" method="post" action="https://www.paypal.com/cgi-bin/webscr"> <form target="_blank" method="post" action="https://www.paypal.com/cgi-bin/webscr">
<% if current_user %> <% if current_user %>
<input name="custom" type="hidden" placeholder="Your Minecraft name" value="<%= current_user.ign %>"> <input name="custom" type="hidden" placeholder="Your Minecraft name" value="<%= current_user.ign %>">

View File

@@ -1,4 +1,4 @@
<% title "Edit Reply: #{@reply.thread.title}" %> <% title "Edit Thread Reply: #{@reply.thread.title}" %>
<% <%
position = @reply.thread.replies.order(:id).index(@reply) position = @reply.thread.replies.order(:id).index(@reply)
@@ -6,10 +6,10 @@
%> %>
<%= link_to @reply.thread.forum.group, forumgroup_path(@reply.thread.forum.group) %> → <%= link_to @reply.thread.forum, @reply.thread.forum %> → <%= link_to @reply.thread, forumthread_path(@reply.thread, page: page) + "#reply-#{@reply.id}" %> → Edit reply <%= link_to @reply.thread.forum.group, forumgroup_path(@reply.thread.forum.group) %> → <%= link_to @reply.thread.forum, @reply.thread.forum %> → <%= link_to @reply.thread, forumthread_path(@reply.thread, page: page) + "#reply-#{@reply.id}" %> → Edit reply
<h1>Edit Reply</h1> <h1>Edit reply</h1>
<%= form_for [@reply.thread, @reply] do |f| %> <%= form_for [@reply.thread, @reply] do |f| %>
<%= render partial: "md_editor", locals: {name: "threadreply[content]", content: @reply.content} %> <%= render partial: "md_editor", locals: {name: "threadreply[content]", content: @reply.content} %>
<p><%= f.submit "Reply", class: "btn blue left" %></p> <p><%= f.submit "Reply", class: "btn blue left" %></p>
<% end %> <% end %>
<p><%= button_to "Delete Reply", [@reply.thread, @reply], method: "delete", data: {confirm: "Delete reply forever?"}, class: "btn red right" %></p> <p><%= button_to "Delete reply", [@reply.thread, @reply], method: "delete", data: {confirm: "Delete reply forever?"}, class: "btn red right" %></p>
<div class="clear"></div> <div class="clear"></div>

View File

@@ -1,10 +1,10 @@
<% title "Change Password" %> <% title "Change Password" %>
<h1>Change Password</h1> <h1>Change password</h1>
<%= form_for @user do |f| %> <%= form_for @user do |f| %>
<%= f.text_field :current_password %> <%= f.text_field :current_password %>
<%= f.text_field :email %> <%= f.text_field :email %>
<%= f.text_field :password %> <%= f.text_field :password %>
<%= f.text_field :password_confirmation %> <%= f.text_field :password_confirmation %>
<% end %> <% end %>

View File

@@ -2,12 +2,12 @@
<% <%
def can_edit? def can_edit?
(@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role) (@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?)
end end
%> %>
<%= link_to @user.name, @user %> → Edit <%= link_to @user.name, @user %> → Edit
<h1>Edit Profile</h1> <h1>Edit profile</h1>
<%= form_for @user do |f| %> <%= form_for @user do |f| %>
<table> <table>
@@ -23,7 +23,7 @@
<td>Role</td> <td>Role</td>
<td> <td>
<% if current_user.role >= @user.role %> <% if current_user.role >= @user.role %>
<%= f.select :role, Role.all_to(current_user.role) %> <%= f.select :role, Role.all_to(current_user.role), {}, { disabled: !can_edit? } %>
<% end %> <% end %>
</td> </td>
</tr> </tr>
@@ -31,7 +31,7 @@
<td>Badge</td> <td>Badge</td>
<td> <td>
<% if current_user.role >= Role.get(:mod) %> <% if current_user.role >= Role.get(:mod) %>
<%= f.select :badge, Badge.all %> <%= f.select :badge, Badge.all, {}, { disabled: !can_edit? } %>
<% end %> <% end %>
</td> </td>
</tr> </tr>
@@ -43,9 +43,9 @@
</tr> </tr>
<% end %> <% end %>
<tr> <tr>
<td>Discord username</td> <td>Skype username</td>
<td> <td>
<%= f.text_field :discord, placeholder: "Discord username", disabled: !can_edit? %> <%= f.text_field :skype, placeholder: "Skype username", disabled: !can_edit? %>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -57,7 +57,7 @@
<tr> <tr>
<td>Twitter username</td> <td>Twitter username</td>
<td> <td>
<%= f.text_field :twitter, placeholder: "Twitter username", disabled: !(@user.is?(current_user) && confirmed? || (mod? && current_user.role >= @user.role)) %> <%= f.text_field :twitter, placeholder: "Twitter username", disabled: !can_edit? %>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -69,15 +69,17 @@
</tbody> </tbody>
</table> </table>
<p><%= f.submit "Save Profile", class: "btn variable-size left", disabled: (!@user.confirmed? && @user.is?(current_user)) %></p> <p><%= f.submit "Save profile", class: "btn variable-size left", disabled: !can_edit? %></p>
<p> <p>
<%= link_to "Login Settings", edit_login_user_path(@user), class: "btn variable-size right" %> <%= link_to "Edit login details", edit_login_user_path(@user), class: "btn variable-size right" %>
<%= link_to "Notification Settings", edit_notifications_user_path(@user), class: "btn variable-size right" %> <%= link_to "Notification settings", edit_notifications_user_path(@user), class: "btn variable-size right" %>
<%= link_to "Website Settings", edit_website_settings_user_path(@user), class: "btn variable-size right" %> <%= link_to "Website settings", edit_website_settings_user_path(@user), class: "btn variable-size right" %>
</p> </p>
<div class="clear"></div> <div class="clear"></div>
<% if !@user.confirmed? %> <% if !@user.is?(current_user) && !current_user.confirmed? %>
<span class='red-alert'>You must confirm your own email before you can edit other profiles.</span>
<% elsif !@user.confirmed? %>
<% if @user.is?(current_user) %> <% if @user.is?(current_user) %>
<span class='red-alert'>Please confirm your email address first!</span> <span class='red-alert'>Please confirm your email address first!</span>
<% else %> <% else %>

View File

@@ -1,7 +1,7 @@
<% title "Edit Login Credentials: #{@user.name}" %> <% title "Edit Login Credentials: #{@user.name}" %>
<%= link_to @user.name, @user %> → Edit Login settings <%= link_to @user.name, @user %> → Edit Login credentials
<h1>Edit Login Settings</h1> <h1>Edit Login credentials</h1>
<%= form_for @user, url: update_login_user_path(@user), method: :put do |f| %> <%= form_for @user, url: update_login_user_path(@user), method: :put do |f| %>
@@ -25,51 +25,14 @@
<%= f.password_field :password_confirmation %> <%= f.password_field :password_confirmation %>
</td> </td>
</tr> </tr>
</tbody>
</table>
<hr>
<table>
<tbody>
<tr>
<td>2FA Enabled</td>
<td>
<%= f.check_box :totp_enabled %>
</td>
</tr>
<tr>
<td>TOTP Secret</td>
<td>
<% if !@user.totp_enabled? %>
<%= f.text_field :totp_secret, :readonly => true %>
<% else %>
<i>2FA is currently enabled. Disable 2FA to generate a new secret.</i>
<% end %>
</td>
</tr>
</tbody>
</table>
<hr>
<table>
<tbody>
<tr> <tr>
<td>Current password</td> <td>Current password</td>
<td> <td>
<%= password_field_tag :current_password, nil, disabled: !@user.is?(current_user) %> <%= password_field_tag :current_password, nil, disabled: !@user.is?(current_user) %>
</td> </td>
</tr> </tr>
<% if !@user.totp_enabled? %>
<tr>
<td>TOTP Code</td>
<td>
<%= text_field_tag :totp_code, nil, disabled: !@user.is?(current_user) %>
</td>
</tr>
<tr>
<td></td>
<td><i>Leave this field blank if you are not enabling 2FA.</i></td>
<% end %>
</tbody> </tbody>
</table> </table>
<p><%= f.submit "Save Changes", class: "btn blue left" %></p> <p><%= f.submit "Save changes", class: "btn blue left" %></p>
<div class="clear"></div> <div class="clear"></div>
<% end %> <% end %>

View File

@@ -1,5 +1,11 @@
<% title "Edit Notification Settings: #{@user.name}" %> <% title "Edit Notification Settings: #{@user.name}" %>
<%
def can_edit?
(@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?)
end
%>
<%= link_to @user.name, @user %> → Edit Notification Settings <%= link_to @user.name, @user %> → Edit Notification Settings
<h1>Edit Notification Settings</h1> <h1>Edit Notification Settings</h1>
@@ -11,13 +17,13 @@
<tr> <tr>
<td>replies to my thread</td> <td>replies to my thread</td>
<td> <td>
<%= f.check_box :mail_own_thread_reply %> <%= f.check_box :mail_own_thread_reply, disabled: !can_edit? %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>replies to a thread I already replied to</td> <td>replies to a thread I already replied to</td>
<td> <td>
<%= f.check_box :mail_other_thread_reply %> <%= f.check_box :mail_other_thread_reply, disabled: !can_edit? %>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -26,13 +32,13 @@
<i>(Currently used for staff only)</i> <i>(Currently used for staff only)</i>
</td> </td>
<td> <td>
<%= f.check_box :mail_own_blogpost_comment %> <%= f.check_box :mail_own_blogpost_comment, disabled: !can_edit? %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>comments a blog post I already commented</td> <td>comments a blog post I already commented</td>
<td> <td>
<%= f.check_box :mail_other_blogpost_comment %> <%= f.check_box :mail_other_blogpost_comment, disabled: !can_edit? %>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -40,14 +46,20 @@
mentions me in a thread or comment mentions me in a thread or comment
</td> </td>
<td> <td>
<%= f.check_box :mail_mention %> <%= f.check_box :mail_mention, disabled: !can_edit? %>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h3>Public Key</h1> <h3>Public Key</h1>
<p>All notification emails will be encrypted with this key if you supply it.</p> <p>All notification emails will be encrypted with this key if you supply it.</p>
<%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----" %> <%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----", disabled: !can_edit? %>
<p><%= f.submit "Save Changes", class: "btn blue left" %></p> <p><%= f.submit "Save changes", class: "btn blue left", disabled: !can_edit? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !@user.is?(current_user) && !current_user.confirmed? %>
<span class='red-alert'>You must confirm your own email before you can edit other user's notification settings.</span>
<% elsif !@user.confirmed? && @user.is?(current_user) %>
<span class='red-alert'>You need to confirm your email before you can edit your notification settings.</span>
<% end %>
<% end %> <% end %>

View File

@@ -1,5 +1,11 @@
<% title "Edit Website Settings: #{@user.name}" %> <% title "Edit Website Settings: #{@user.name}" %>
<%
def can_edit?
(@user.is?(current_user) && confirmed?) || (mod? && current_user.role >= @user.role && current_user.confirmed?)
end
%>
<%= link_to @user.name, @user %> → Edit Website Settings <%= link_to @user.name, @user %> → Edit Website Settings
<h1>Edit Website Settings</h1> <h1>Edit Website Settings</h1>
@@ -8,25 +14,33 @@
<table> <table>
<tbody> <tbody>
<tr> <tr>
<td>Header moves with scrolling</td> <td>Header moves with scrolling (Experimental - do not report bugs)</td>
<td> <td>
<%= f.check_box :header_scroll %> <%= f.check_box :header_scroll, disabled: !can_edit? %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Show exact UTC times</td> <td>Show exact UTC times</td>
<td> <td>
<%= f.check_box :utc_time %> <%= f.check_box :utc_time, disabled: !can_edit? %>
</td> </td>
</tr> </tr>
<tr> <tr>
<td>Dark theme</td> <td>Dark theme*</td>
<td> <td>
<%= f.check_box :dark %> <%= f.check_box :dark, disabled: !can_edit? %>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p><%= f.submit "Save Changes", class: "btn blue left" %></p> <p><%= f.submit "Save changes", class: "btn blue left", disabled: !can_edit? %></p>
<div class="clear"></div> <div class="clear"></div>
<% if !@user.is?(current_user) && !current_user.confirmed? %>
<span class='red-alert'>You must confirm your own email before you can edit other user's website settings.</span>
<% elsif !@user.confirmed? && @user.is?(current_user) %>
<span class='red-alert'>You need to confirm your email before you can edit your website settings.</span>
<% end %>
<% end %> <% end %>
<br><br><br>
*Warning: If as a result to enabling this style your eyes get infected with a severe case of eye cancer, we are not reliable for any damage. Please contact your doctor in advance to ensure that in case of infection you will be treated accordingly. Quality theme brought to you by Redempt™.

View File

@@ -1,6 +1,6 @@
<% title "Reset Password" %> <% title "Reset password" %>
<h1>Reset Password</h1> <h1>Reset password</h1>
<p>You lost your password? Don't do that!</p> <p>You lost your password? Don't do that!</p>
<p>Luckily for you, you can reset your password. Please use the command <code>/gettoken &lt;your email address&gt;</code>, then fill in the form below:</p> <p>Luckily for you, you can reset your password. Please use the command <code>/gettoken &lt;your email address&gt;</code>, then fill in the form below:</p>
<%= form_tag reset_password_users_path do |f| %> <%= form_tag reset_password_users_path do |f| %>
@@ -22,5 +22,5 @@
<td><%= password_field_tag :new_password, nil, placeholder: "secret", required: true, pattern: ".{8,}", title: "minimum 8 characters", "x-moz-errormessage" => "minimum 8 characters" %></td> <td><%= password_field_tag :new_password, nil, placeholder: "secret", required: true, pattern: ".{8,}", title: "minimum 8 characters", "x-moz-errormessage" => "minimum 8 characters" %></td>
</tr> </tr>
</table> </table>
<p><%= submit_tag "Reset Password", class: "btn blue" %></p> <p><%= submit_tag "Reset password", class: "btn blue" %></p>
<% end %> <% end %>

View File

@@ -1,6 +1,6 @@
<% title "Sign Up" %> <% title "Sign up" %>
<h1>Sign Up</h1> <h1>Sign up</h1>
<%= form_for @user do |f| %> <%= form_for @user do |f| %>
<table> <table>
@@ -38,7 +38,7 @@
You can find more details in our info page about <a href="/info/15">tokens and website registration</a>. You can find more details in our info page about <a href="/info/15">tokens and website registration</a>.
</p> </p>
<%= f.submit "Sign Up", class: "btn blue" %> <%= f.submit "Sign up", class: "btn blue" %>
<p>Contact us ingame if you have problems signing up!</p> <p>Contact us ingame if you have problems signing up!</p>
<% end %> <% end %>

View File

@@ -16,16 +16,27 @@
<div class="clear"></div> <div class="clear"></div>
<% if @ban_json && (@ban_json["expires"] == "forever" || !(DateTime.parse(@ban_json["expires"]) <= DateTime.now)) %> <% if @ban_json && (@ban_json["expires"] == "forever" || !(DateTime.parse(@ban_json["expires"]) <= DateTime.now)) %>
<span class="user-banned">This user is banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span> <% if @user.is?(current_user) %>
<span class="user-banned">You are banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span>
<% else %>
<span class="user-banned">This user is banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span>
<% end %>
<% end %> <% end %>
<% if @user.banned? %> <% if @user.banned? %>
<% if @user.is?(current_user) %>
<span class="user-banned">You are banned on the website!</span>
<% else %>
<span class="user-banned">This user is banned on the website!</span> <span class="user-banned">This user is banned on the website!</span>
<% end %>
<% end %> <% end %>
<br> <br>
<% if !@user.confirmed? %> <% if !@user.confirmed? %>
<% if @user.is?(current_user) || mod? %> <% if @user.is?(current_user) %>
<span class="user-unconfirmed">Please confirm your email <u><%= @user.email %></u> !</span> <span class="user-unconfirmed">You haven't confirmed your email "<u><%= @user.email %></u>" yet!</span>
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn blue", form_class: "inline-block", data: {confirm: "Did you check your spam folder?"} %> <%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn dark", form_class: "inline-block", data: {confirm: "Did you check your spam folder?"} %>
<% elsif mod? %>
<span class="user-unconfirmed">This user hasn't confirmed their email "<u><%= @user.email %></u>" yet!</span>
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn dark", form_class: "inline-block" %>
<% else %> <% else %>
<span class="user-unconfirmed">This user hasn't confirmed their email yet!</span> <span class="user-unconfirmed">This user hasn't confirmed their email yet!</span>
<% end %> <% end %>
@@ -54,10 +65,10 @@
<td><b>Role</b></td> <td><b>Role</b></td>
<td><%= link_to @user.role, users_path(:role => @user.role.name) %></td> <td><%= link_to @user.role, users_path(:role => @user.role.name) %></td>
</tr> </tr>
<% if current_user && !@user.discord.blank? %> <% if current_user && !@user.skype.blank? %>
<tr> <tr>
<td><b>Discord</b></td> <td><b>Skype</b></td>
<td><%= @user.discord %></td> <td><%= link_to @user.skype, "skype:#{@user.skype}?chat", target: "_blank" %></a></td>
</tr> </tr>
<% end %> <% end %>
<% if !@user.youtube.blank? && !@user.youtube_channelname.blank? %> <% if !@user.youtube.blank? && !@user.youtube_channelname.blank? %>
@@ -82,16 +93,6 @@
<td><b>Joined</b></td> <td><b>Joined</b></td>
<td><%= ago @user.created_at %></td> <td><%= ago @user.created_at %></td>
</tr> </tr>
<tr>
<td><b>Last seen</b></td>
<td>
<% if @user.last_seen %>
<%= ago @user.last_seen %>
<% else %>
Never
<% end %>
</td>
</tr>
<% if mod? || @user.is?(current_user) %> <% if mod? || @user.is?(current_user) %>
<tr> <tr>
<td><b>Last IP</b></td> <td><b>Last IP</b></td>
@@ -101,6 +102,16 @@
<td><b>Email</b></td> <td><b>Email</b></td>
<td><%= mail_to @user.email, @user.email, :subject => "Redstoner" %></td> <td><%= mail_to @user.email, @user.email, :subject => "Redstoner" %></td>
</tr> </tr>
<tr>
<td><b>Last seen</b></td>
<td>
<% if @user.last_seen %>
<%= ago @user.last_seen %>
<% else %>
Never
<% end %>
</td>
</tr>
<% end %> <% end %>
</tbody> </tbody>
</table> </table>

View File

@@ -1,5 +1,5 @@
# config valid only for current version of Capistrano # config valid only for current version of Capistrano
lock '3.11.0' lock '3.4.0'
set :repo_url, 'https://github.com/RedstonerServer/redstoner.com' set :repo_url, 'https://github.com/RedstonerServer/redstoner.com'
@@ -13,9 +13,9 @@ set :default_environment, {
set :keep_releases, 5 set :keep_releases, 5
set :deploy_to, -> { "/var/www/#{fetch(:application)}" } set :deploy_to, -> { "/home/www-data/apps/#{fetch(:application)}" }
set :rbenv_ruby, '2.5.0-dev' set :rbenv_ruby, '2.0.0-p648'
set :bundle_without, %w{development test}.join(' ') set :bundle_without, %w{development test}.join(' ')
@@ -24,4 +24,4 @@ set :linked_dirs, fetch(:linked_dirs, []).push('bin', 'log', 'tmp/pids', 'tmp/ca
namespace :deploy do namespace :deploy do
after :publishing, :restart after :publishing, :restart
end end

View File

@@ -37,12 +37,12 @@ Redstoner::Application.configure do
} }
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
address: ENV["SMTP_ADDRESS"], address: "smtp.gmail.com",
port: ENV["SMTP_PORT"], port: 587,
domain: "redstoner.com", domain: "google.com",
authentication: ENV["SMTP_AUTH"], authentication: "plain",
user_name: ENV["SMTP_USERNAME"], user_name: "redstonerserver@gmail.com",
password: ENV["SMTP_PASSWORD"], password: ENV["GMAIL_PASSWORD"],
} }
end end

View File

@@ -71,12 +71,12 @@ Redstoner::Application.configure do
} }
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
address: ENV["SMTP_ADDRESS"], address: "smtp.gmail.com",
port: ENV["SMTP_PORT"], port: 587,
domain: "redstoner.com", domain: "google.com",
authentication: ENV["SMTP_AUTH"], authentication: "plain",
user_name: ENV["SMTP_USERNAME"], user_name: "redstonerserver@gmail.com",
password: ENV["SMTP_PASSWORD"], password: ENV["GMAIL_PASSWORD"],
} }
end end

View File

@@ -3,8 +3,8 @@ timeout 15
preload_app true preload_app true
stderr_path "/var/www/redstoner/shared/log/unicorn.stderr.log" stderr_path "/home/www-data/apps/redstoner/shared/log/unicorn.stderr.log"
stdout_path "/var/www/redstoner/shared/log/unicorn.stdout.log" stdout_path "/home/www-data/apps/redstoner/shared/log/unicorn.stdout.log"
before_fork do |server, worker| before_fork do |server, worker|
Signal.trap 'TERM' do Signal.trap 'TERM' do
@@ -23,4 +23,4 @@ after_fork do |server, worker|
defined?(ActiveRecord::Base) and defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection ActiveRecord::Base.establish_connection
end end

View File

@@ -1,6 +0,0 @@
class AddTotpToUsers < ActiveRecord::Migration
def change
add_column :users, :totp_secret, :string
add_column :users, :totp_enabled, :boolean, default: false
end
end

View File

@@ -1,5 +0,0 @@
class DropForumsLabels < ActiveRecord::Migration
def change
drop_table :forums_labels
end
end

View File

@@ -1,6 +0,0 @@
class RemoveSkypeAddDiscordFromUsers < ActiveRecord::Migration
def change
remove_column :users, :skype
add_column :users, :discord, :string
end
end

View File

@@ -1,5 +0,0 @@
class DisableDeletionForums < ActiveRecord::Migration
def change
add_column :forums, :disable_deletion, :boolean
end
end

View File

@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190224093907) do ActiveRecord::Schema.define(version: 20171013001146) do
create_table "badges", force: :cascade do |t| create_table "badges", force: :cascade do |t|
t.string "name", limit: 191 t.string "name", limit: 191
@@ -46,13 +46,17 @@ ActiveRecord::Schema.define(version: 20190224093907) do
end end
create_table "forums", force: :cascade do |t| create_table "forums", force: :cascade do |t|
t.string "name", limit: 255 t.string "name", limit: 255
t.integer "position", limit: 4 t.integer "position", limit: 4
t.integer "role_read_id", limit: 4 t.integer "role_read_id", limit: 4
t.integer "role_write_id", limit: 4 t.integer "role_write_id", limit: 4
t.integer "forumgroup_id", limit: 4 t.integer "forumgroup_id", limit: 4
t.integer "necro_length", limit: 4 t.integer "necro_length", limit: 4
t.boolean "disable_deletion", default: false end
create_table "forums_labels", id: false, force: :cascade do |t|
t.integer "forum_id", limit: 4
t.integer "label_id", limit: 4
end end
create_table "forumthreads", force: :cascade do |t| create_table "forumthreads", force: :cascade do |t|
@@ -130,6 +134,7 @@ ActiveRecord::Schema.define(version: 20190224093907) do
t.string "email", limit: 191 t.string "email", limit: 191
t.text "about", limit: 65535 t.text "about", limit: 65535
t.string "last_ip", limit: 255 t.string "last_ip", limit: 255
t.string "skype", limit: 255
t.string "youtube", limit: 255 t.string "youtube", limit: 255
t.string "youtube_channelname", limit: 255 t.string "youtube_channelname", limit: 255
t.string "twitter", limit: 255 t.string "twitter", limit: 255
@@ -149,15 +154,12 @@ ActiveRecord::Schema.define(version: 20190224093907) do
t.boolean "header_scroll", default: false t.boolean "header_scroll", default: false
t.boolean "dark", default: false t.boolean "dark", default: false
t.text "public_key", limit: 65535 t.text "public_key", limit: 65535
t.string "totp_secret", limit: 255
t.boolean "totp_enabled", default: false
t.string "discord", limit: 191
end end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["ign"], name: "index_users_on_ign", unique: true, using: :btree add_index "users", ["ign"], name: "index_users_on_ign", unique: true, using: :btree
add_index "users", ["name"], name: "index_users_on_name", unique: true, using: :btree add_index "users", ["name"], name: "index_users_on_name", unique: true, using: :btree
add_index "users", ["discord"], name: "index_users_on_discord", unique: true, using: :btree add_index "users", ["skype"], name: "index_users_on_skype", unique: true, using: :btree
add_index "users", ["twitter"], name: "index_users_on_twitter", unique: true, using: :btree add_index "users", ["twitter"], name: "index_users_on_twitter", unique: true, using: :btree
add_index "users", ["uuid"], name: "index_users_on_uuid", unique: true, using: :btree add_index "users", ["uuid"], name: "index_users_on_uuid", unique: true, using: :btree
add_index "users", ["youtube"], name: "index_users_on_youtube", unique: true, using: :btree add_index "users", ["youtube"], name: "index_users_on_youtube", unique: true, using: :btree

View File

@@ -32,7 +32,7 @@ deleted_user = User.create!(
password_confirmation: userpw, password_confirmation: userpw,
role: Role.get(:disabled), role: Role.get(:disabled),
badge: Badge.get(:none), badge: Badge.get(:none),
discord: "echo123#9804", skype: "echo123",
last_ip: "0.0.0.0", last_ip: "0.0.0.0",
confirmed: true, confirmed: true,
last_seen: Time.utc(0).to_datetime, last_seen: Time.utc(0).to_datetime,
@@ -40,4 +40,4 @@ deleted_user = User.create!(
utc_time: false, utc_time: false,
dark: false dark: false
) )
deleted_user.update_attribute(:ign, "Steve") deleted_user.update_attribute(:ign, "Steve")