1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: 15: 16: 17: 18: 19: 20: 21: 22:
23: class IMP_Ajax_Application_Handler_Passphrase extends Horde_Core_Ajax_Application_Handler
24: {
25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35:
36: public function checkPassphrase()
37: {
38: global $injector, $notification;
39:
40: $result = false;
41:
42: if (!$this->vars->dialog_input) {
43: $notification->push(_("No passphrase entered."), 'horde.error');
44: return $result;
45: }
46:
47: try {
48: Horde::requireSecureConnection();
49:
50: switch ($this->vars->type) {
51: case 'pgpPersonal':
52: $result = $injector->getInstance('IMP_Crypt_Pgp')->storePassphrase('personal', $this->vars->dialog_input);
53: break;
54:
55: case 'pgpSymmetric':
56: $result = $injector->getInstance('IMP_Crypt_Pgp')->storePassphrase('symmetric', $this->vars->dialog_input, $this->vars->symmetricid);
57: break;
58:
59: case 'smimePersonal':
60: $result = $injector->getInstance('IMP_Crypt_Smime')->storePassphrase($this->vars->dialog_input);
61: break;
62: }
63:
64: if ($result) {
65: $notification->push(_("Passphrase verified."), 'horde.success');
66: } else {
67: $notification->push(_("Invalid passphrase entered."), 'horde.error');
68: }
69: } catch (Horde_Exception $e) {
70: $notification->push($e, 'horde.error');
71: }
72:
73: return ($result && $this->vars->reload)
74: ? new Horde_Core_Ajax_Response_HordeCore_Reload($this->vars->reload)
75: : $result;
76: }
77:
78: }
79: