Actions
2 years ago
Concerns
2 years ago
Contracts
3 years ago
Exceptions
2 years ago
Facades
4 years ago
LegacyNodes
3 years ago
Properties
1 year ago
ValueObjects
2 years ago
Amount.php
2 years ago
Authentication.php
1 year ago
BillingAddress.php
2 years ago
Checkbox.php
2 years ago
Consent.php
2 years ago
Date.php
1 year ago
DonationAmount.php
2 years ago
DonationForm.php
2 years ago
DonationSummary.php
2 years ago
Element.php
3 years ago
Email.php
2 years ago
Factory.php
4 years ago
Field.php
2 years ago
File.php
1 year ago
Form.php
3 years ago
Group.php
3 years ago
Hidden.php
3 years ago
Honeypot.php
1 year ago
Html.php
3 years ago
MultiSelect.php
1 year ago
Name.php
2 years ago
Option.php
2 years ago
Paragraph.php
2 years ago
Password.php
2 years ago
PaymentGateways.php
2 years ago
Phone.php
1 year ago
Radio.php
2 years ago
Section.php
2 years ago
SecurityChallenge.php
1 year ago
Select.php
2 years ago
Text.php
2 years ago
Textarea.php
2 years ago
Types.php
2 years ago
Url.php
2 years ago
Authentication.php
77 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Give\Framework\FieldsAPI; |
| 6 | |
| 7 | class Authentication extends Group |
| 8 | { |
| 9 | const TYPE = 'authentication'; |
| 10 | |
| 11 | protected $required = false; |
| 12 | protected $isAuthenticated = false; |
| 13 | protected $loginRedirect = false; |
| 14 | protected $loginRedirectUrl; |
| 15 | protected $loginNotice; |
| 16 | protected $loginConfirmation; |
| 17 | protected $lostPasswordUrl; |
| 18 | |
| 19 | public static function make($name) |
| 20 | { |
| 21 | return parent::make($name) |
| 22 | ->append( |
| 23 | Text::make('login') |
| 24 | ->label(__('Username', 'give')) |
| 25 | ->placeholder(__('Enter your username or email', 'give')) |
| 26 | ) |
| 27 | ->append( |
| 28 | Password::make('password') |
| 29 | ->label(__('Password', 'give')) |
| 30 | ->placeholder(__('Enter your password', 'give')) |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | public function required($value = true): self |
| 35 | { |
| 36 | $this->required = $value; |
| 37 | return $this; |
| 38 | } |
| 39 | |
| 40 | public function isAuthenticated($value = true): self |
| 41 | { |
| 42 | $this->isAuthenticated = $value; |
| 43 | return $this; |
| 44 | } |
| 45 | |
| 46 | public function loginRedirect($value = true): self |
| 47 | { |
| 48 | $this->loginRedirect = $value; |
| 49 | return $this; |
| 50 | } |
| 51 | |
| 52 | public function loginRedirectUrl($value): self |
| 53 | { |
| 54 | $this->loginRedirectUrl = $value; |
| 55 | return $this; |
| 56 | } |
| 57 | |
| 58 | public function loginNotice($value): self |
| 59 | { |
| 60 | $this->loginNotice = $value; |
| 61 | return $this; |
| 62 | } |
| 63 | |
| 64 | public function loginConfirmation($value): self |
| 65 | { |
| 66 | $this->loginConfirmation = $value; |
| 67 | return $this; |
| 68 | } |
| 69 | |
| 70 | |
| 71 | public function lostPasswordUrl($value): self |
| 72 | { |
| 73 | $this->lostPasswordUrl = $value; |
| 74 | return $this; |
| 75 | } |
| 76 | } |
| 77 |