File indexing completed on 2024-12-22 05:33:35
0001 <?php 0002 /** 0003 * ocs-webserver 0004 * 0005 * Copyright 2016 by pling GmbH. 0006 * 0007 * This file is part of ocs-webserver. 0008 * 0009 * This program is free software: you can redistribute it and/or modify 0010 * it under the terms of the GNU Affero General Public License as 0011 * published by the Free Software Foundation, either version 3 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU Affero General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU Affero General Public License 0020 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0021 **/ 0022 class Default_Form_Login extends Zend_Form 0023 { 0024 0025 public function init() 0026 { 0027 $this->setMethod('POST'); 0028 $this->setAction('/login/'); 0029 $this->addElementPrefixPath('Local', 'Local/'); 0030 $this->setAttrib('id', 'loginForm'); 0031 //$this->setAttrib('class', 'standard-form row-fluid'); 0032 0033 $this->addElement($this->getHiddenRedirect()); 0034 0035 $dologin = $this->createElement('hidden', 'dologin'); 0036 $dologin->setValue('true'); 0037 $dologin->setDecorators(array('ViewHelper')); 0038 $this->addElement($dologin); 0039 0040 0041 $loginName = $this->createElement('text', 'mail'); 0042 $loginName->setLabel('index.login.username'); 0043 $loginName->setFilters(array('StringTrim')); 0044 // $loginName->setValidators(array('EmailAddress')); 0045 $loginName->setRequired(true); 0046 $loginName->setDecorators(array('ViewHelper')); 0047 //$loginName->setAttrib('placeholder', 'Email or Username'); 0048 //$loginName->setAttrib('class', 'inputbox email'); 0049 0050 $loginPass = $this->createElement('password', 'password'); 0051 $loginPass->setLabel('index.login.password'); 0052 $loginPass->setFilters(array('StringTrim')); 0053 $loginPass->setRequired(true); 0054 $loginPass->setDecorators(array('ViewHelper')); 0055 //$loginPass->setAttrib('placeholder', 'Password'); 0056 //$loginPass->setAttrib('class', 'inputbox password'); 0057 0058 $rememberMe = $this->createElement('checkbox', 'remember_me') 0059 ->setOptions(array("checked" => "checked")) 0060 ->setLabel('index.login.remember_me') 0061 ->setDecorators( 0062 array( 0063 'ViewHelper', 0064 array('Label', 0065 array( 0066 'placement' => 'append', 0067 'class' => 'optional' 0068 ) 0069 ), 0070 array('HtmlTag', array('tag' => 'div', 'class' => 'container-checkbox-remember-me text-left')) 0071 ) 0072 ); 0073 0074 $submit = $this->createElement('button', 'login'); 0075 $submit->setLabel('Login'); 0076 $submit->setDecorators(array('ViewHelper')); 0077 //$submit->setAttrib('class', 'btn btn-min-width btn-native'); 0078 //$submit->setAttrib('type', 'submit'); 0079 0080 // $hash = $this->createElement('hash', 'csrfLogin', array('salt' => 'PlattenSpalter')); 0081 // $hash->setDecorators(array('ViewHelper', 'Errors')); 0082 // $hash->getValidator('Identical')->setMessage('Your session is outdated. Please reload the page an try again.'); 0083 // $this->addElement($hash); 0084 0085 0086 $this->addElement($loginName); 0087 $this->addElement($loginPass); 0088 $this->addElement($rememberMe); 0089 $this->addElement($submit); 0090 } 0091 0092 private function getHiddenRedirect() 0093 { 0094 return $this->createElement('hidden', 'redirect') 0095 ->setFilters(array('StringTrim')) 0096 ->setDecorators( 0097 array( 0098 array( 0099 'ViewScript', 0100 array( 0101 'viewScript' => 'authorization/viewscripts/input_hidden.phtml', 0102 'placement' => false 0103 ) 0104 ) 0105 )); 0106 } 0107 0108 }