|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* YAWIK |
|
4
|
|
|
* |
|
5
|
|
|
* @filesource |
|
6
|
|
|
* @copyright (c) 2013-2015 Cross Solution (http://cross-solution.de) |
|
7
|
|
|
* @license MIT |
|
8
|
|
|
* @author [email protected] |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace Auth\Options; |
|
12
|
|
|
|
|
13
|
|
|
use Zend\Stdlib\AbstractOptions; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class ModuleOptions |
|
17
|
|
|
* |
|
18
|
|
|
* defines AbstractOptions of the Auth Module |
|
19
|
|
|
*/ |
|
20
|
|
|
class CaptchaOptions extends AbstractOptions |
|
21
|
|
|
{ |
|
22
|
|
|
|
|
23
|
|
|
const RE_CAPTCHA = 'reCaptcha'; |
|
24
|
|
|
const IMAGE = 'image'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* enable captcha feature. Possible values: |
|
28
|
|
|
* - none: captcha feature is disabled |
|
29
|
|
|
* - reCaptcha: Google reCaptcha service is used. |
|
30
|
|
|
* - image: local images are created |
|
31
|
|
|
* |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $mode = 'none'; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* you have to create your private/public key. |
|
38
|
|
|
* See https://www.google.com/recaptcha/admin#list |
|
39
|
|
|
* |
|
40
|
|
|
* @var array |
|
41
|
|
|
*/ |
|
42
|
|
|
protected $reCaptcha = [ |
|
43
|
|
|
'public_key' => 'Your Recapture Public Key', // "site_key" |
|
44
|
|
|
'private_key' => 'Your Recapture Private Key', // "secret_key" |
|
45
|
|
|
'ssl' => true, // include google api via http(s) |
|
46
|
|
|
]; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* image mode creates local images by using the php gd extension |
|
50
|
|
|
* |
|
51
|
|
|
* @var array |
|
52
|
|
|
*/ |
|
53
|
|
|
protected $image = [ |
|
54
|
|
|
'expiration' => '300', |
|
55
|
|
|
'wordlen' => '7', |
|
56
|
|
|
'font' => 'data/fonts/arial.ttf', |
|
57
|
|
|
'fontSize' => '20', |
|
58
|
|
|
'imgDir' => 'public/captcha', |
|
59
|
|
|
'imgUrl' => '/captcha' |
|
60
|
|
|
]; |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @param $mode |
|
64
|
|
|
* @return $this |
|
65
|
|
|
*/ |
|
66
|
|
|
public function setMode($mode) |
|
67
|
|
|
{ |
|
68
|
|
|
$this->mode = $mode; |
|
69
|
|
|
return $this; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @return bool |
|
|
|
|
|
|
74
|
|
|
*/ |
|
75
|
|
|
public function getMode() |
|
76
|
|
|
{ |
|
77
|
|
|
return $this->mode; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @param $reCaptcha |
|
82
|
|
|
* @return $this |
|
83
|
|
|
*/ |
|
84
|
|
|
public function setReCaptcha($reCaptcha) |
|
85
|
|
|
{ |
|
86
|
|
|
$this->reCaptcha = $reCaptcha; |
|
87
|
|
|
return $this; |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return array |
|
92
|
|
|
*/ |
|
93
|
|
|
public function getReCaptcha() |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->reCaptcha; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* @param $image |
|
100
|
|
|
* @return $this |
|
101
|
|
|
*/ |
|
102
|
|
|
public function setImage($image) |
|
103
|
|
|
{ |
|
104
|
|
|
$this->image = $image; |
|
105
|
|
|
return $this; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @return array |
|
110
|
|
|
*/ |
|
111
|
|
|
public function getImage() |
|
112
|
|
|
{ |
|
113
|
|
|
return $this->image; |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
|
|
117
|
|
|
} |
|
118
|
|
|
|
This check compares the return type specified in the
@returnannotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.