Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into 5078-email-field-on…
Browse files Browse the repository at this point in the history
…-add-person
  • Loading branch information
asbiin committed Apr 30, 2021
2 parents 9bbaaa2 + 5007932 commit 4c2941d
Show file tree
Hide file tree
Showing 17 changed files with 149 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ APP_DEBUG=false
# The encryption key. This is the most important part of the application. Keep
# this secure otherwise, everyone will be able to access your application.
# Must be 32 characters long exactly.
# Use `php artisan key:generate` or `pwgen -s 32 1` to generate a random key.
# Use `php artisan key:generate` or `echo -n 'base64:'; openssl rand -base64 32` to generate a random key.
APP_KEY=ChangeMeBy32KeyLengthOrGenerated

# Prevent information leakage by referring to IDs with hashIds instead of
Expand Down
12 changes: 12 additions & 0 deletions app/Exceptions/AccountLimitException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Exceptions;

use RuntimeException;

/**
* Exception thrown if the account has reach its.
*/
class AccountLimitException extends RuntimeException
{
}
5 changes: 5 additions & 0 deletions app/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use LaravelWebauthn\Models\WebauthnKey;
use App\Http\Requests\InvitationRequest;
use App\Services\Contact\Tag\DestroyTag;
use App\Exceptions\AccountLimitException;
use App\Services\Account\Settings\ResetAccount;
use App\Services\Account\Settings\DestroyAccount;
use PragmaRX\Google2FALaravel\Facade as Google2FA;
Expand Down Expand Up @@ -300,6 +301,10 @@ public function addUser()
*/
public function inviteUser(InvitationRequest $request)
{
if (AccountHelper::hasLimitations(auth()->user()->account)) {
throw new AccountLimitException();
}

// Make sure the confirmation to invite has not been bypassed
if (! $request->input('confirmation')) {
return redirect()->back()->withErrors(trans('settings.users_error_please_confirm'))->withInput();
Expand Down
10 changes: 10 additions & 0 deletions app/Services/Contact/Contact/CreateContact.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
use App\Services\BaseService;
use App\Helpers\AccountHelper;
use function Safe\json_encode;
use App\Models\Account\Account;
use App\Models\Contact\Contact;
use App\Jobs\AuditLog\LogAccountAudit;
use App\Models\Contact\ContactFieldType;
use App\Exceptions\AccountLimitException;
use App\Jobs\Avatars\GenerateDefaultAvatar;
use App\Jobs\Avatars\GetAvatarsFromInternet;
use App\Services\Contact\ContactField\CreateContactField;
Expand Down Expand Up @@ -60,6 +63,13 @@ public function execute(array $data): Contact
{
$this->validate($data);

$account = Account::find($data['account_id']);
if (AccountHelper::hasReachedContactLimit($account)
&& AccountHelper::hasLimitations($account)
&& ! $account->legacy_free_plan_unlimited_contacts) {
throw new AccountLimitException();
}

// filter out the data that shall not be updated here
$dataOnly = Arr::except(
$data,
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/providers/debian.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Install PHP 7.4 with these extensions:

```sh
sudo apt install -y php php-bcmath php-curl php-gd php-gmp php-imagick \
php-intl php-mbstring php-mysql php-xml php-zip
php-intl php-mbstring php-mysql php-redis php-xml php-zip
```

**Composer:** After you're done installing PHP, you'll need the Composer dependency manager.
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/providers/heroku.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Monica can be deployed on Heroku using the button below:
## Installation

Before deployment, Heroku will ask you to define a few variables.
- Please ensure to enter a custom `APP_KEY` when asked (if, for example, you have the `pwgen` utility installed, you could copy and paste the output of `pwgen -s 32 1`).
- Please ensure to enter a custom `APP_KEY` when asked (you can for instance copy and paste the output of `echo -n 'base64:'; openssl rand -base64 32`).
- In addition, you can edit the email address Monica will send emails to (`MAIL_FROM_ADDRESS`), the name of the sender (`MAIL_FROM_NAME`), where emails should link to (`APP_URL`) and some other important variables on that screen.

After deployment, click on ![Manage App](../../images/heroku_manage_app.png) to open the dashboard of your new application:
Expand Down
6 changes: 3 additions & 3 deletions docs/installation/providers/ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ Then install php 7.4 with these extensions:

```sh
sudo apt update
sudo apt install -y php7.4 php7.4-cli php7.4-common php7.4-fpm \
php7.4-json php7.4-opcache php7.4-mysql php7.4-mbstring php7.4-zip \
php7.4-bcmath php7.4-intl php7.4-xml php7.4-curl php7.4-gd php7.4-gmp php7.4-imagick
sudo apt install -y php7.4 php7.4-bcmath php7.4-cli php7.4-curl php7.4-common php7.4-fpm \
php7.4-gd php7.4-gmp php7.4-imagick php7.4-intl php7.4-json php7.4-mbstring \
php7.4-mysql php7.4-opcache php7.4-redis php7.4-xml php7.4-zip
```

**Composer:** After you're done installing PHP, you'll need the [Composer](https://getcomposer.org/download/) dependency manager.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"devDependencies": {
"cross-env": "^7.0",
"cypress": "^6.1",
"cypress": "^7.2.0",
"eslint": "^7.10",
"eslint-config-standard": "^16.0",
"eslint-plugin-cypress": ">=2.11.2",
Expand Down
2 changes: 1 addition & 1 deletion public/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/app.js": "/js/app.js?id=c209f84736fc5642105c",
"/js/app.js": "/js/app.js?id=1266e86e9d9bbbfb5d76",
"/js/stripe.js": "/js/stripe.js?id=b0050dad15c02b83363d",
"/js/manifest.js": "/js/manifest.js?id=895f51a7a2cbcfaf0d03",
"/css/app-rtl.css": "/css/app-rtl.css?id=e976d220373bd82dfe46",
Expand Down
14 changes: 14 additions & 0 deletions resources/js/components/people/gifts/Gift.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
.photo {
height: 200px;
}
.gift-date{
float: right;
}
</style>

<template>
Expand All @@ -13,6 +16,7 @@
</a>
<strong v-else>{{ gift.name }}</strong>
</span>
<span v-if="gift.date" class="f7 gift-date">{{ formatDate(gift.date) }}</span>

<span v-if="gift.recipient && gift.recipient.complete_name">
<span class="black-50 mr1 ml1">
Expand Down Expand Up @@ -101,6 +105,16 @@ export default {
this.$refs.modalPhoto.open();
},
formatDate(dateAsString) {
const moment = require('moment-timezone');
moment.locale(this._i18n.locale);
moment.tz.setDefault('UTC');
var date = moment.tz(moment(dateAsString), this.$root.timezone);
return date.format('LL');
},
}
};
</script>
6 changes: 2 additions & 4 deletions resources/views/errors/layout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
<base href="{{ url('/') }}/" />
<title>@yield('title')</title>

<link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">

<style>
html, body {
height: 100%;
Expand All @@ -15,10 +13,10 @@
margin: 0;
padding: 0;
width: 100%;
color: #B0BEC5;
color: #999999;
display: table;
font-weight: 100;
font-family: 'Lato';
font-family: "Lato Light", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
.container {
Expand Down
1 change: 0 additions & 1 deletion resources/views/marketing/skeleton.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1">
<title>{{ trans('app.application_title') }}</title>

<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" rel="stylesheet">
<link rel="stylesheet" href="{{ asset(mix('css/app-'.htmldir().'.css')) }}">
<meta name="description" content="{{ trans('app.application_description') }}">
<link rel="author" href="@djaiss">
Expand Down
8 changes: 2 additions & 6 deletions scripts/vagrant/build/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,20 @@ VAGRANTFILE_API_VERSION ||= "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

config.vm.synced_folder ".", "/vagrant"

config.vm.provider "virtualbox" do |vb|
vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
end

# Create a box with the latest version available
config.vm.define "monicahq-latest", primary: true do |monicahq|
monicahq.vm.box = "ubuntu/bionic64"
monicahq.vm.hostname = "monica"

monicahq.vm.boot_timeout = 180
monicahq.vm.provision "shell", path: "install-monica.sh", keep_color: true
end

# Create a box with the specific version tag
config.vm.define "monicahq-stable" do |monicahq|
monicahq.vm.box = "ubuntu/bionic64"
monicahq.vm.hostname = "monica"

monicahq.vm.boot_timeout = 180
monicahq.vm.provision "shell", path: "install-monica.sh", keep_color: true, env: {"GIT_TAG" => "#{ENV['GIT_TAG']}"}
end

Expand Down
13 changes: 6 additions & 7 deletions scripts/vagrant/build/install-monica.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ debconf-set-selections <<< "mysql-server mysql-server/root_password_again passwo
apt-get install -y mysql-server mysql-client >/dev/null

echo -e "\n\033[4;32mInstalling PHP 7.4\033[0;40m"
apt install -y curl gnupg2 apt-transport-https apt-transport-https lsb-release ca-certificates
curl -s https://packages.sury.org/php/apt.gpg -o /etc/apt/trusted.gpg.d/php.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list
apt-get install -y curl gnupg2 apt-transport-https apt-transport-https lsb-release ca-certificates >/dev/null
add-apt-repository -y ppa:ondrej/php >/dev/null
apt-get update >/dev/null
apt-get install -y php7.4 >/dev/null

Expand All @@ -49,12 +48,12 @@ apt-get install -y git >/dev/null

echo -e "\n\033[4;32mInstalling composer\033[0;40m"
apt-get install -y curl php7.4-cli >/dev/null
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer >/dev/null

echo -e "\n\033[4;32mInstalling packages for Monica\033[0;40m"
apt-get install -y php7.4-common php7.4-fpm \
php7.4-json php7.4-opcache php7.4-mysql php7.4-mbstring php7.4-zip \
php7.4-bcmath php7.4-intl php7.4-xml php7.4-curl php7.4-gd php7.4-gmp php7.4-imagick >/dev/null
apt-get install -y php7.4-bcmath php7.4-cli php7.4-curl php7.4-common php7.4-fpm \
php7.4-gd php7.4-gmp php7.4-imagick php7.4-intl php7.4-json php7.4-mbstring \
php7.4-mysql php7.4-opcache php7.4-redis php7.4-xml php7.4-zip >/dev/null

echo -e "\n\033[4;32mGetting database ready\033[0;40m"
mysql -uroot -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE $MYSQL_DB_DATABASE;
Expand Down
4 changes: 2 additions & 2 deletions scripts/vagrant/install-vagrant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

# set version of vagrant to use :
vagrantversion=2.2.14
vagrantversion=2.2.15

mkdir -p $HOME/vagrant
pushd $HOME/vagrant > /dev/null
Expand All @@ -15,7 +15,7 @@ if [ ! -d "vagrant-$vagrantversion" ]; then

curl -Os https://releases.hashicorp.com/vagrant/${vagrantversion}/vagrant_${vagrantversion}_SHA256SUMS
curl -Os https://releases.hashicorp.com/vagrant/${vagrantversion}/vagrant_${vagrantversion}_SHA256SUMS.sig
gpg --keyserver keys.gnupg.net --recv-keys 51852D87348FFC4C
gpg --keyserver keys.gnupg.net --recv-keys 72D7468F

verif=0
if gpg --quiet --verify vagrant_${vagrantversion}_SHA256SUMS.sig vagrant_${vagrantversion}_SHA256SUMS 2>/dev/null; then
Expand Down
Loading

0 comments on commit 4c2941d

Please sign in to comment.