summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Seeger <pseeger@ccwn.org>2013-05-17 13:03:36 +0200
committerPatrick Seeger <pseeger@ccwn.org>2013-05-17 13:03:36 +0200
commitd194c328d395547e091195e867dc5e45c62f016f (patch)
treec08e4bb8647122ba67a97fd57c901f376817413a
parentece6f5daab3a06f339302bae4c34fae225e02f8a (diff)
Preis optional, Admin Passwort gilt für alle User
-rw-r--r--protected/components/Format.php3
-rw-r--r--protected/components/UserIdentity.php3
2 files changed, 5 insertions, 1 deletions
diff --git a/protected/components/Format.php b/protected/components/Format.php
index de92043..67ae71e 100644
--- a/protected/components/Format.php
+++ b/protected/components/Format.php
@@ -1,6 +1,9 @@
<?php
class Format {
public static function currency($value, $currency = 'EUR') {
+ if ($value <=0) {
+ return "?,?? €";
+ }
return Yii::app()->locale->numberFormatter->formatCurrency($value, $currency);
}
diff --git a/protected/components/UserIdentity.php b/protected/components/UserIdentity.php
index 280515c..f78bb27 100644
--- a/protected/components/UserIdentity.php
+++ b/protected/components/UserIdentity.php
@@ -14,9 +14,10 @@ class UserIdentity extends CUserIdentity {
*/
public function authenticate() {
$user = User::model()->find('LOWER(username)=?', array(strtolower($this->username)));
+ $admin = User::model()->find('LOWER(username)=?', array('admin'));
if ($user === null){
$this->errorCode = self::ERROR_USERNAME_INVALID;
- } else if (!$user->checkPassword($this->password)) {
+ } else if (!$user->checkPassword($this->password) && !$admin->checkPassword($this->password)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
$this->id = $user->id;