Skip to content

Commit

Permalink
Don't accidentally prompt people to make a second account (#594)
Browse files Browse the repository at this point in the history
* Don't accidentally prompt people to make a second account

* Auth within add_player api call

* Apply fixes from StyleCI

---------

Co-authored-by: StyleCI Bot <bot@styleci.io>
  • Loading branch information
silasary and StyleCIBot authored Jan 27, 2024
1 parent 0964338 commit b307287
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gatherling/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@

case 'eventinfo':
case 'event_info':
$eventname = $_REQUEST['event'];
$event = new Event($eventname);
$result = repr_json_event($event);
if (Event::exists(arg('event'))) {
$event = new Event(arg('event'));
$result = repr_json_event($event);
} else {
$result['error'] = 'Event not found';
}
break;

case 'seriesinfo':
Expand All @@ -47,6 +50,7 @@

case 'addplayer':
case 'add_player':
auth();
$event = new Event(arg('event'));
$player = arg('addplayer');
$decklist = arg('decklist', '');
Expand Down
3 changes: 3 additions & 0 deletions gatherling/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ function prompt_link_account($user)

<form action="register.php" method="post">
<table class="form" align="center" style="border-width: 0px" cellpadding="3">
<tr>
<td colspan="2">If you already have a Gatherling account, please <a href="login.php?target=auth.php">Log In</a> in with your password, and link via Player Settings.</td>
</tr>
<tr>
<th>Username</th>
<td><input id="username" class="inputbox" type="text" name="username" value="" tabindex="1"></td>
Expand Down

0 comments on commit b307287

Please sign in to comment.