mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
strtolower new keys
This commit is contained in:
parent
f40b72c014
commit
7b233def5f
@ -56,7 +56,7 @@ class AppController extends BaseController
|
|||||||
$test = Input::get('test');
|
$test = Input::get('test');
|
||||||
|
|
||||||
$app = Input::get('app');
|
$app = Input::get('app');
|
||||||
$app['key'] = env('APP_KEY') ?: str_random(RANDOM_KEY_LENGTH);
|
$app['key'] = env('APP_KEY') ?: strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$app['debug'] = Input::get('debug') ? 'true' : 'false';
|
$app['debug'] = Input::get('debug') ? 'true' : 'false';
|
||||||
$app['https'] = Input::get('https') ? 'true' : 'false';
|
$app['https'] = Input::get('https') ? 'true' : 'false';
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ class AppController extends BaseController
|
|||||||
$_ENV['MAIL_FROM_ADDRESS'] = $mail['from']['address'];
|
$_ENV['MAIL_FROM_ADDRESS'] = $mail['from']['address'];
|
||||||
$_ENV['MAIL_PASSWORD'] = $mail['password'];
|
$_ENV['MAIL_PASSWORD'] = $mail['password'];
|
||||||
$_ENV['PHANTOMJS_CLOUD_KEY'] = 'a-demo-key-with-low-quota-per-ip-address';
|
$_ENV['PHANTOMJS_CLOUD_KEY'] = 'a-demo-key-with-low-quota-per-ip-address';
|
||||||
$_ENV['PHANTOMJS_SECRET'] = str_random(RANDOM_KEY_LENGTH);
|
$_ENV['PHANTOMJS_SECRET'] = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$_ENV['MAILGUN_DOMAIN'] = $mail['mailgun_domain'];
|
$_ENV['MAILGUN_DOMAIN'] = $mail['mailgun_domain'];
|
||||||
$_ENV['MAILGUN_SECRET'] = $mail['mailgun_secret'];
|
$_ENV['MAILGUN_SECRET'] = $mail['mailgun_secret'];
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class TokenController extends BaseController
|
|||||||
} else {
|
} else {
|
||||||
$token = AccountToken::createNew();
|
$token = AccountToken::createNew();
|
||||||
$token->name = trim(Input::get('name'));
|
$token->name = trim(Input::get('name'));
|
||||||
$token->token = str_random(RANDOM_KEY_LENGTH);
|
$token->token = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
$token->save();
|
$token->save();
|
||||||
|
@ -199,8 +199,8 @@ class UserController extends BaseController
|
|||||||
$user->username = trim(Input::get('email'));
|
$user->username = trim(Input::get('email'));
|
||||||
$user->email = trim(Input::get('email'));
|
$user->email = trim(Input::get('email'));
|
||||||
$user->registered = true;
|
$user->registered = true;
|
||||||
$user->password = str_random(RANDOM_KEY_LENGTH);
|
$user->password = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$user->confirmation_code = str_random(RANDOM_KEY_LENGTH);
|
$user->confirmation_code = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$user->public_id = $lastUser->public_id + 1;
|
$user->public_id = $lastUser->public_id + 1;
|
||||||
if (Auth::user()->hasFeature(FEATURE_USER_PERMISSIONS)) {
|
if (Auth::user()->hasFeature(FEATURE_USER_PERMISSIONS)) {
|
||||||
$user->is_admin = boolval(Input::get('is_admin'));
|
$user->is_admin = boolval(Input::get('is_admin'));
|
||||||
|
@ -290,7 +290,7 @@ class Client extends EntityModel
|
|||||||
if (isset($data['contact_key']) && $this->account->account_key == env('NINJA_LICENSE_ACCOUNT_KEY')) {
|
if (isset($data['contact_key']) && $this->account->account_key == env('NINJA_LICENSE_ACCOUNT_KEY')) {
|
||||||
$contact->contact_key = $data['contact_key'];
|
$contact->contact_key = $data['contact_key'];
|
||||||
} else {
|
} else {
|
||||||
$contact->contact_key = str_random(RANDOM_KEY_LENGTH);
|
$contact->contact_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class Contact extends EntityModel implements AuthenticatableContract, CanResetPa
|
|||||||
public function getContactKeyAttribute($contact_key)
|
public function getContactKeyAttribute($contact_key)
|
||||||
{
|
{
|
||||||
if (empty($contact_key) && $this->id) {
|
if (empty($contact_key) && $this->id) {
|
||||||
$this->contact_key = $contact_key = str_random(RANDOM_KEY_LENGTH);
|
$this->contact_key = $contact_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
static::where('id', $this->id)->update(['contact_key' => $contact_key]);
|
static::where('id', $this->id)->update(['contact_key' => $contact_key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ class User extends Authenticatable
|
|||||||
// if the user changes their email then they need to reconfirm it
|
// if the user changes their email then they need to reconfirm it
|
||||||
if ($user->isEmailBeingChanged()) {
|
if ($user->isEmailBeingChanged()) {
|
||||||
$user->confirmed = 0;
|
$user->confirmed = 0;
|
||||||
$user->confirmation_code = str_random(RANDOM_KEY_LENGTH);
|
$user->confirmation_code = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class AccountRepository
|
|||||||
|
|
||||||
$account = new Account();
|
$account = new Account();
|
||||||
$account->ip = Request::getClientIp();
|
$account->ip = Request::getClientIp();
|
||||||
$account->account_key = str_random(RANDOM_KEY_LENGTH);
|
$account->account_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$account->company_id = $company->id;
|
$account->company_id = $company->id;
|
||||||
|
|
||||||
// Track referal code
|
// Track referal code
|
||||||
@ -62,14 +62,14 @@ class AccountRepository
|
|||||||
|
|
||||||
$user = new User();
|
$user = new User();
|
||||||
if (! $firstName && ! $lastName && ! $email && ! $password) {
|
if (! $firstName && ! $lastName && ! $email && ! $password) {
|
||||||
$user->password = str_random(RANDOM_KEY_LENGTH);
|
$user->password = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$user->username = str_random(RANDOM_KEY_LENGTH);
|
$user->username = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
} else {
|
} else {
|
||||||
$user->first_name = $firstName;
|
$user->first_name = $firstName;
|
||||||
$user->last_name = $lastName;
|
$user->last_name = $lastName;
|
||||||
$user->email = $user->username = $email;
|
$user->email = $user->username = $email;
|
||||||
if (! $password) {
|
if (! $password) {
|
||||||
$password = str_random(RANDOM_KEY_LENGTH);
|
$password = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
}
|
}
|
||||||
$user->password = bcrypt($password);
|
$user->password = bcrypt($password);
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ class AccountRepository
|
|||||||
$user->registered = ! Utils::isNinja() || $email;
|
$user->registered = ! Utils::isNinja() || $email;
|
||||||
|
|
||||||
if (! $user->confirmed) {
|
if (! $user->confirmed) {
|
||||||
$user->confirmation_code = str_random(RANDOM_KEY_LENGTH);
|
$user->confirmation_code = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
$account->users()->save($user);
|
$account->users()->save($user);
|
||||||
@ -332,7 +332,7 @@ class AccountRepository
|
|||||||
$invitation->public_id = $publicId;
|
$invitation->public_id = $publicId;
|
||||||
$invitation->invoice_id = $invoice->id;
|
$invitation->invoice_id = $invoice->id;
|
||||||
$invitation->contact_id = $client->contacts()->first()->id;
|
$invitation->contact_id = $client->contacts()->first()->id;
|
||||||
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
|
$invitation->invitation_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$invitation->save();
|
$invitation->save();
|
||||||
|
|
||||||
return $invitation;
|
return $invitation;
|
||||||
@ -356,7 +356,7 @@ class AccountRepository
|
|||||||
$account->company_id = $company->id;
|
$account->company_id = $company->id;
|
||||||
$account->save();
|
$account->save();
|
||||||
|
|
||||||
$random = str_random(RANDOM_KEY_LENGTH);
|
$random = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->registered = true;
|
$user->registered = true;
|
||||||
$user->confirmed = true;
|
$user->confirmed = true;
|
||||||
@ -683,7 +683,7 @@ class AccountRepository
|
|||||||
|
|
||||||
$token = AccountToken::createNew($user);
|
$token = AccountToken::createNew($user);
|
||||||
$token->name = $name;
|
$token->name = $name;
|
||||||
$token->token = str_random(RANDOM_KEY_LENGTH);
|
$token->token = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$token->save();
|
$token->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class ContactRepository extends BaseRepository
|
|||||||
$contact->send_invoice = true;
|
$contact->send_invoice = true;
|
||||||
$contact->client_id = $data['client_id'];
|
$contact->client_id = $data['client_id'];
|
||||||
$contact->is_primary = Contact::scope()->where('client_id', '=', $contact->client_id)->count() == 0;
|
$contact->is_primary = Contact::scope()->where('client_id', '=', $contact->client_id)->count() == 0;
|
||||||
$contact->contact_key = str_random(RANDOM_KEY_LENGTH);
|
$contact->contact_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
} else {
|
} else {
|
||||||
$contact = Contact::scope($publicId)->firstOrFail();
|
$contact = Contact::scope($publicId)->firstOrFail();
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,7 @@ class InvoiceRepository extends BaseRepository
|
|||||||
$invitation = Invitation::createNew($invoice);
|
$invitation = Invitation::createNew($invoice);
|
||||||
$invitation->invoice_id = $invoice->id;
|
$invitation->invoice_id = $invoice->id;
|
||||||
$invitation->contact_id = $contact->id;
|
$invitation->contact_id = $contact->id;
|
||||||
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
|
$invitation->invitation_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$invitation->save();
|
$invitation->save();
|
||||||
} elseif (! in_array($contact->id, $sendInvoiceIds) && $invitation) {
|
} elseif (! in_array($contact->id, $sendInvoiceIds) && $invitation) {
|
||||||
$invitation->delete();
|
$invitation->delete();
|
||||||
@ -842,7 +842,7 @@ class InvoiceRepository extends BaseRepository
|
|||||||
foreach ($invoice->invitations as $invitation) {
|
foreach ($invoice->invitations as $invitation) {
|
||||||
$cloneInvitation = Invitation::createNew($invoice);
|
$cloneInvitation = Invitation::createNew($invoice);
|
||||||
$cloneInvitation->contact_id = $invitation->contact_id;
|
$cloneInvitation->contact_id = $invitation->contact_id;
|
||||||
$cloneInvitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
|
$cloneInvitation->invitation_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$clone->invitations()->save($cloneInvitation);
|
$clone->invitations()->save($cloneInvitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1018,7 +1018,7 @@ class InvoiceRepository extends BaseRepository
|
|||||||
foreach ($recurInvoice->invitations as $recurInvitation) {
|
foreach ($recurInvoice->invitations as $recurInvitation) {
|
||||||
$invitation = Invitation::createNew($recurInvitation);
|
$invitation = Invitation::createNew($recurInvitation);
|
||||||
$invitation->contact_id = $recurInvitation->contact_id;
|
$invitation->contact_id = $recurInvitation->contact_id;
|
||||||
$invitation->invitation_key = str_random(RANDOM_KEY_LENGTH);
|
$invitation->invitation_key = strtolower(str_random(RANDOM_KEY_LENGTH));
|
||||||
$invoice->invitations()->save($invitation);
|
$invoice->invitations()->save($invitation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class UserTableSeeder extends Seeder
|
|||||||
'state' => $faker->state,
|
'state' => $faker->state,
|
||||||
'postal_code' => $faker->postcode,
|
'postal_code' => $faker->postcode,
|
||||||
'country_id' => Country::all()->random()->id,
|
'country_id' => Country::all()->random()->id,
|
||||||
'account_key' => str_random(RANDOM_KEY_LENGTH),
|
'account_key' => strtolower(str_random(RANDOM_KEY_LENGTH)),
|
||||||
'invoice_terms' => $faker->text($faker->numberBetween(50, 300)),
|
'invoice_terms' => $faker->text($faker->numberBetween(50, 300)),
|
||||||
'work_phone' => $faker->phoneNumber,
|
'work_phone' => $faker->phoneNumber,
|
||||||
'work_email' => $faker->safeEmail,
|
'work_email' => $faker->safeEmail,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user