| 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 |
|