Skip to content

Commit

Permalink
feat: update to v3 and add an is_details_visible for when users dont …
Browse files Browse the repository at this point in the history
…meet requirements
  • Loading branch information
ScuffedNewt committed Sep 12, 2024
2 parents 0a63035 + 46cafa3 commit 01bbc96
Show file tree
Hide file tree
Showing 815 changed files with 75,979 additions and 34,697 deletions.
6 changes: 6 additions & 0 deletions .bladeformatterrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"indentSize": 4,
"wrapLineLength": 250,
"endWithNewLine": true,
"useTabs": false
}
1 change: 1 addition & 0 deletions .bladeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vendor/*
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
target-branch: "develop"
schedule:
interval: "weekly"
- package-ecosystem: "composer"
directory: "/"
target-branch: "develop"
schedule:
interval: "weekly"
27 changes: 27 additions & 0 deletions .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint

on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
types:
- opened
- edited
- synchronize
- reopened

jobs:
pint:
uses: itinerare/github-actions/.github/workflows/pint.yml@main
with:
php-version: '8.1'
concurrency:
group: ci-${{ github.head_ref || github.ref_name }}

blade-formatter:
uses: itinerare/github-actions/.github/workflows/blade_formatter.yml@main
concurrency:
group: ci-${{ github.head_ref || github.ref_name }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/composer.lock
*.env
/composer.phar
*.cache
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Lorekeeper Contribution Guide

For support and general questions and discussions, please visit the [support Discord server](https://discord.gg/U4JZfsu)! Please do not use the issue tracker for general support questions. Please also remember that unless explicitly stated otherwise/you have hired services to that end, all support is free and offered on a volunteer basis, and there is no guarantee or obligation upon maintainers and/or community members to provide support.

The following are accepted uses for the [issue tracker](https://github.com/corowne/Lorekeeper/issues):
- Bug reports
- Feature or enhancement requests (within reason)-- note that these may be denied if they are deemed out of scope of the project and/or are not feasible to implement for any reason.

## Opening an Issue
### Reporting a bug

File bugs in the [issue tracker](https://github.com/corowne/Lorekeeper/issues). Please follow these guidelines:

- Search existing issues first! Make sure your issue hasn't already been reported.
- Stay on topic, but describe the issue in detail so that others can reproduce it.
- Don't use one issue for multiple bugs! Keeping them 1:1 helps with tracking and fixing problems. Similarly, don't make multiple issues for one bug.
- Provide screenshot(s) if possible.

### Feature requests

It's recommended to discuss potential new features in the [support Discord](https://discord.gg/U4JZfsu) before creating an issue, as this helps check that it is valid for a feature request and if it would be useful to others-- something which increases its likelihood of being implemented. Please also check that your request has not already been posted on the [issue tracker](https://github.com/corowne/Lorekeeper/issues).

Avoid listing multiple requests in one issue. One issue per request makes it easier to track and discuss it. If need be, you may make multiple issues (within reason), but do not spam. Do not make multiple issues for the same request.

## Contributing Code

Please see the full [Contribution Guide](http://wiki.lorekeeper.me/index.php?title=Contributing_to_Lorekeeper) for more information!

### About abandoned pull requests

In the case where a pull request is started but not finished and the contributor is nonresponsive despite efforts to contact them, the pull request will be closed regardless of its status. It is up to contributors to finish work, make any requested changes, etc., not maintainers.

However, knowledge from the issue and/or pull request may be used to create a new pull request, potentially based on the changes from the closed pull request.
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

Lorekeeper is a framework for managing deviantART-based ARPGs/closed species masterlists coded using the Laravel framework. In simple terms - you will be able to make a copy of the site, do some minor setup/enter data about your species and game, and it'll provide you with the automation to keep track of your species, players and ARPG submissions.

Demo site: [http://lorekeeper.me/](http://lorekeeper.me/)
Wiki for users: [http://lorekeeper-arpg.wikidot.com/](http://lorekeeper-arpg.wikidot.com/)
- Demo site: [http://lorekeeper.me/](http://lorekeeper.me/)
- Wiki: [http://wiki.lorekeeper.me](http://wiki.lorekeeper.me/index.php?title=Main_Page)

# Features

Expand All @@ -19,11 +19,11 @@ Wiki for users: [http://lorekeeper-arpg.wikidot.com/](http://lorekeeper-arpg.wik
- Speaking of which, you can search for characters based on traits, rarity, etc. Also, trait/item/etc. data get their own searchable lists - no need to create additional pages detailing restrictions on how a trait should be drawn/described.
- Unless you want to, in which case you can add custom pages in HTML without touching the codebase!
- A raffle roller for consecutive raffles! Mods can add/remove tickets and users who have already won something will be automatically removed from future raffles in the sequence.
- ...and more! Please refer to the [Wiki](http://lorekeeper-arpg.wikidot.com/) for more information and instructions for usage.
- ...and more! Please refer to the [Wiki](http://wiki.lorekeeper.me/index.php?title=Category:Documentation) for more information and instructions for usage.

# Setup

Important: For those who are not familiar with web dev, please refer to the [Wiki](http://lorekeeper-arpg.wikidot.com/) for a much more detailed set of instructions!!
Important: For those who are not familiar with web dev, please refer to the [Wiki](http://wiki.lorekeeper.me/index.php?title=Tutorial:_Setting_Up) for a much more detailed set of instructions!!

## Obtain a copy of the code

Expand All @@ -37,16 +37,12 @@ $ git clone https://github.com/corowne/lorekeeper.git
$ cp .env.example .env
```

deviantART client ID and secret are required for this step.
While obtaining the ID and secret, also add whitelist entries for redirection for your site URL (if being hosted) or localhost (if working locally).
Client ID and secret for at least one supported social media platform are required for this step. See [the Wiki](http://wiki.lorekeeper.me/index.php?title=Category:Social_Media_Authentication) for platform-specific instructions.

Add the following to .env, filling them in as required (also fill in the rest of .env where relevant):
```
CONTACT_ADDRESS=(contact email address)
DEVIANTART_ACCOUNT=(username of ARPG group account)
DEVIANTART_CLIENT_ID=(client ID as supplied by deviantART)
DEVIANTART_CLIENT_SECRET=(client secret as supplied by deviantART)
DEVIANTART_CALLBACK_URL=/
```

## Setting up
Expand Down Expand Up @@ -74,8 +70,8 @@ Finally, set up the admin account for logging in:
$ php artisan setup-admin-user
```

You will need to send yourself the verification email and then link your dA account as prompted.
You will need to send yourself the verification email and then link your social media account as prompted.

## Contact

If you have any questions, please feel free to contact me through email: [email protected]
If you have any questions, please feel free to ask in the Discord server: https://discord.gg/U4JZfsu
45 changes: 45 additions & 0 deletions app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace App\Actions\Fortify;

use App\Models\Invitation;
use App\Models\User\User;
use App\Services\InvitationService;
use App\Services\UserService;
use Illuminate\Support\Facades\Hash;
use Laravel\Fortify\Contracts\CreatesNewUsers;

class CreateNewUser implements CreatesNewUsers {
use PasswordValidationRules;

/**
* Validate and create a newly registered user.
*
* @return \App\Models\User
*/
public function create(array $input) {
(new UserService)->validator($input)->validate();

$user = User::create([
'name' => $input['name'],
'email' => $input['email'],
'password' => Hash::make($input['password']),
'rank_id' => 2,
'birthday' => $input['dob'],
]);
$user->settings()->create([
'user_id' => $user->id,
]);
$user->profile()->create([
'user_id' => $user->id,
]);

if (isset($input['code'])) {
if (!(new InvitationService)->useInvitation(Invitation::where('code', $input['code'])->whereNull('recipient_id')->first(), $user)) {
throw new \Exception('An error occurred while using the invitation code.');
}
}

return $user;
}
}
16 changes: 16 additions & 0 deletions app/Actions/Fortify/PasswordValidationRules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace App\Actions\Fortify;

use Laravel\Fortify\Rules\Password;

trait PasswordValidationRules {
/**
* Get the validation rules used to validate passwords.
*
* @return array
*/
protected function passwordRules() {
return ['required', 'string', new Password, 'confirmed'];
}
}
26 changes: 26 additions & 0 deletions app/Actions/Fortify/ResetUserPassword.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Actions\Fortify;

use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\ResetsUserPasswords;

class ResetUserPassword implements ResetsUserPasswords {
use PasswordValidationRules;

/**
* Validate and reset the user's forgotten password.
*
* @param mixed $user
*/
public function reset($user, array $input) {
Validator::make($input, [
'password' => $this->passwordRules(),
])->validate();

$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}
31 changes: 31 additions & 0 deletions app/Actions/Fortify/UpdateUserPassword.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Actions\Fortify;

use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\UpdatesUserPasswords;

class UpdateUserPassword implements UpdatesUserPasswords {
use PasswordValidationRules;

/**
* Validate and update the user's password.
*
* @param mixed $user
*/
public function update($user, array $input) {
Validator::make($input, [
'current_password' => ['required', 'string'],
'password' => $this->passwordRules(),
])->after(function ($validator) use ($user, $input) {
if (!isset($input['current_password']) || !Hash::check($input['current_password'], $user->password)) {
$validator->errors()->add('current_password', __('The provided password does not match your current password.'));
}
})->validateWithBag('updatePassword');

$user->forceFill([
'password' => Hash::make($input['password']),
])->save();
}
}
54 changes: 54 additions & 0 deletions app/Actions/Fortify/UpdateUserProfileInformation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\Actions\Fortify;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;

class UpdateUserProfileInformation implements UpdatesUserProfileInformation {
/**
* Validate and update the given user's profile information.
*
* @param mixed $user
*/
public function update($user, array $input) {
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],

'email' => [
'required',
'string',
'email',
'max:255',
Rule::unique('users')->ignore($user->id),
],
])->validateWithBag('updateProfileInformation');

if ($input['email'] !== $user->email &&
$user instanceof MustVerifyEmail) {
$this->updateVerifiedUser($user, $input);
} else {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
])->save();
}
}

/**
* Update the given verified user's profile information.
*
* @param mixed $user
*/
protected function updateVerifiedUser($user, array $input) {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
'email_verified_at' => null,
])->save();

$user->sendEmailVerificationNotification();
}
}
Loading

0 comments on commit 01bbc96

Please sign in to comment.