Skip to content

Commit

Permalink
Release v1.0
Browse files Browse the repository at this point in the history
* Change config location

* Config mailer

* Edit readme

* Edit default_url

* Edit email to temporary address

* Hungarify mailers

* fix grammar error, & fix protocol & set subject tag
  • Loading branch information
bbucsy authored Oct 3, 2021
1 parent bd2968f commit d57cf18
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 26 deletions.
2 changes: 0 additions & 2 deletions .env.example

This file was deleted.

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ yarn-debug.log*
.idea/*
/.env
.vscode

/config/credentials/development.key
/config/credentials/development.yml.enc
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,29 @@ The database is accessible on port `5433`, so you must update the port in `confi
After creating the database container you have to set up the database from the console.

### AuthSCH setup
Copy .env.example to .env:
Create an Outh Client at https://auth.sch.bme.hu with the follwing callback url:
```bash
http://localhost:3000/users/auth/authsch/callback
```
Run rails credentials editor

```bash
mv .env.example .env
rails credentials:edit --environment development
```

Create an Outh Client at https://auth.sch.bme.hu with the follwing callback url:
or if it complains about default editor not being set

```bash
http://localhost:3000/users/auth/authsch/callback
EDITOR=nano rails credentials:edit --environment development
```
Complete '.env' with the `client id` and `client secret`, and restart the server.
copy the following yaml, and replace with OAuth credentials
```yaml
authsch:
api_key: <authsch client id>
secret: <authsch secret>
```
and then save the file. It will generate a key and encrypted crededentials file. These should be ommited from git commits.


## Linting
The project uses rubocop to enforce good quality code. On the local machine you can run rubocop to detect mistakes with
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/mailer/confirmation_instructions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

<p>Erősítse meg jelszavát a linken keresztül:</p>

<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
<p><%= link_to 'Jelszó megerősítése', confirmation_url(@resource, confirmation_token: @token) %></p>
4 changes: 2 additions & 2 deletions app/views/devise/mailer/email_changed.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p>Üdv, <%= @email %>!</p>

<% if @resource.try(:unconfirmed_email?) %>
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
<p>A Schönherz Airsoft Team weboldalán az email címe megváltozott: <%= @resource.unconfirmed_email %>.</p>
<% else %>
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
<p>A Schönherz Airsoft Team weboldalán az email címe megváltozott: <%= @resource.email %>.</p>
<% end %>
2 changes: 1 addition & 1 deletion app/views/devise/mailer/password_change.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<p>Üdv, <%= @resource.email %>!</p>

<p>We're contacting you to notify you that your password has been changed.</p>
<p>A Schönherz Airsoft Team weboldalán az jelszava megváltozott</p>
8 changes: 4 additions & 4 deletions app/views/devise/mailer/reset_password_instructions.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<p>Üdv, <%= @resource.email %>!</p>

<p>Someone has requested a link to change your password. You can do this through the link below.</p>
<p>A Schönherz Airsoft Team weboldalán valaki a jelszó megváltoztatását kérte</p>

<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
<p><%= link_to 'Jelszó megváltoztatása', edit_password_url(@resource, reset_password_token: @token) %></p>

<p>If you didn't request this, please ignore this email.</p>
<p>Your password won't change until you access the link above and create a new one.</p>
<p>Ha nem te kezdeményezted, hagyd figyelmen kívül ezt az email-t.</p>
<p>A jelszó nem fog megváltozni, amíg valaki nem kattint a linkre.</p>
6 changes: 3 additions & 3 deletions app/views/devise/mailer/unlock_instructions.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<p>Üdv, <%= @resource.email %>!</p>

<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
<p>A fiókod a Schönherz Airsoft Team weboldalán lezárásra került túl sok sikertelen bejelentkezési próbálkozás miatt.</p>

<p>Click the link below to unlock your account:</p>
<p>Kattints az alábbi linkre, hogy feloldjad:</p>

<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
<p><%= link_to 'Fiók feloldása', unlock_url(@resource, unlock_token: @token) %></p>
2 changes: 1 addition & 1 deletion config/credentials.yml.enc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MaJ+RcpU3ADD3H/n6f2NuUjttEVhm9Rn7xIhbYpcIl5bjfiO25u72fkplc65fXXwAyh6vSCOCW4YYo7n/cDkLnyUQvUVzC8E6NWGbz2yMtssh3nxCX5Ak+t2jzOhzwCrWk/FJ4FnFVZE449VR3oVfwmtkgsk+erMZAgdmcdZ9qpYXNzI7tQyM6LID8JG3hAv+FnkIJEnkzw8ZcujJdtFPSEk65OXmRPiD3rdngSaIBkBh9If1GE9Q/E1a8/lF7+tfoFi7uZCsVcg3MVReLTSNG76VEKvADmcDu6Fmsix247P0GETc0SUccJd451YP3d/A4P8k86BDx5ruIT6qWEOg1DmtSY6bWykVrnrSIMJuWMke7FN+GuH1ulEsM32Y49E4baGXdb8T6v4bCeryh4C7b240Hm6EGijezVw--7vjsTgcQ2LqMZHwV--2UvIV3eiMRJbkELFgC4c2g==
xIOgCsfKPFn5IZH1dihLMaE3KIrCTYQVr2jTDrhxvnCo/OwvhMcDKO/wp0Cdkd8ESOigD1vo0HMVdj41FThk6784OwSAj4PnCW6dexswgGJxwOniEHrBajA2FCoQ0fSB9eZEa5ep/6d3hqW7A3aBwkycK1CckFTBDxQcIMFdkby0IL2LQd4Um8QL9StTG3fASUZ7HnV2xSjwBulRH/LOVvzvk5rqCuoF0G3kf3DWdh09p1LlQUhzJE2IJy4LmkMSWk1BHcelCNY4uhglxBaw666319/pS/uGpTvz3kf36GsiyqVWVdBIY4nJIjCXa+KdLsqG/2pidwf4D9hjCZNNjnFJSlvf2p9kOJFzj2z6IkVtJ/cokE6Vk1ngSnlPW6/VRvrHvjnRfOzQk0tl6QYE1STO3NvOo7BgNJkKikaci3iiGGgkjPjc9hTEF0DEr17g6SC0huK81fit5xdsANgCxKbHMqF9fhSsTR+2lERh7cw0hD3NYca6JCqEugQz5Uvk0YQxF6jQKUK28q5Q+55+5s3BLvs/TUL+EgYQvphlJEaNFmN5TMkqUs0zeiiSPXWm4OG0iXjbteYmYOYMp2s9k7f7D5MhYbmlzMehqum5mL2/D55X/WtwgMfX656sMZymQKhYv+MdejBQFVGy2D1JDWsVAz41oLFHQxxwLpaiC3DssmYEMt214dx6abgz6xdwm+C9u1dAk5bcyezJspvhhvW/j8mH/o2fPzhEz9hPbuRfjLY=--0mlqA4oLqRFcKtq3--AMBNz98y7h4nbok9nmB3Zw==
17 changes: 15 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
config.log_level = :debug

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
config.log_tags = [:request_id]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store
Expand All @@ -60,7 +60,20 @@
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "airsoft_production"

config.action_mailer.perform_caching = false
config.action_mailer.perform_caching = false
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { host: Rails.application.credentials[:email][:domain], protocol: 'https' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
user_name: Rails.application.credentials[:email][:user],
password: Rails.application.credentials[:email][:password],
domain: Rails.application.credentials[:email][:domain],
address: Rails.application.credentials[:email][:host],
port: '587',
authentication: :plain,
enable_starttls_auto: true
}

# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
Expand Down
4 changes: 2 additions & 2 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = '[email protected]'
config.mailer_sender = '[email protected]'

# Configure the class responsible to send e-mails.
# config.mailer = 'Devise::Mailer'
Expand Down Expand Up @@ -271,7 +271,7 @@
# ==> OmniAuth
# Add a new OmniAuth provider. Check the wiki for more information on setting
# up on your models and hooks.
config.omniauth :authsch, ENV['AUTHSCH_APP_ID'], ENV['AUTHSCH_SECRET'], scope: "basic mail displayName"
config.omniauth :authsch, Rails.application.credentials[:authsch][:api_key], Rails.application.credentials[:authsch][:secret], scope: "basic mail displayName"


# ==> Warden configuration
Expand Down
6 changes: 3 additions & 3 deletions config/locales/devise.hu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ hu:
failure: 'Nem sikerült azonosítani %{kind} fiókkal, az ok: "%{reason}".'
mailer:
confirmation_instructions:
subject: 'Email cím megerősítés'
subject: '[AirsoftSCH] Email cím megerősítés'
reset_password_instructions:
subject: 'Jelszó megváltoztatása'
subject: '[AirsoftSCH] Jelszó megváltoztatása'
unlock_instructions:
subject: 'Fiók zárolásának megszüntetése'
subject: '[AirsoftSCH] Fiók zárolásának megszüntetése'
errors:
messages:
expired: "lejárt, igényelj egy újat"
Expand Down

0 comments on commit d57cf18

Please sign in to comment.