openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 4bdb1cd6b80eb2ff8a982c31a8c74c997e6a9c1f
parent 889cae5b5d21988f0e40b80381ce327cd032976b
Author: dankert <dankert@laptop-jan>
Date:   Thu, 21 Mar 2013 19:31:55 +0100

Kennwortänderung ist nur erlaubt, wenn das Login über die interne Datenbank geschah.

Diffstat:
Maction/LoginAction.class.php | 3+++
Maction/ProfileAction.class.php | 2++
Mmodel/User.class.php | 1+
Mthemes/default/templates/profile/pw.tpl.src.xml | 67++++++++++++++++++++++++++++++++++++-------------------------------
4 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/action/LoginAction.class.php b/action/LoginAction.class.php @@ -870,6 +870,7 @@ class LoginAction extends Action $loginOk = false; $mustChangePassword = false; $groups = null; + $lastModule = null; // Jedes Authentifizierungsmodul durchlaufen, bis ein Login erfolgreich ist. foreach( $modules as $module) @@ -885,6 +886,7 @@ class LoginAction extends Action if ( $loginOk ) { Logger::info('Login successful for '.$loginName); + $lastModule = $module; if ( isset($auth->groups ) ) $groups = $auth->groups; @@ -908,6 +910,7 @@ class LoginAction extends Action { // Benutzer über den Benutzernamen laden. $user = User::loadWithName($loginName); + $user->loginModuleName = $lastModule; Session::setUser($user); } catch( ObjectNotFoundException $ex ) diff --git a/action/ProfileAction.class.php b/action/ProfileAction.class.php @@ -131,6 +131,8 @@ class ProfileAction extends Action */ function pwView() { + $user = $this->getUserFromSession(); + $this->setTemplateVar('ok', strtolower($user->loginModuleName) == 'internal'); } diff --git a/model/User.class.php b/model/User.class.php @@ -44,6 +44,7 @@ class User var $mustChangePassword = false; var $groups = null; + var $loginModuleName = null; // Konstruktor function User( $userid='' ) diff --git a/themes/default/templates/profile/pw.tpl.src.xml b/themes/default/templates/profile/pw.tpl.src.xml @@ -4,39 +4,44 @@ <logo name="changepassword"></logo> - <group title="message:user_act_password"> - <part class="line"> - <part class="label"> - <label for="act_password"> - <text text="user_password"></text> - </label> + <if true="var:ok"> + <group title="message:user_act_password"> + <part class="line"> + <part class="label"> + <label for="act_password"> + <text text="user_password"></text> + </label> + </part> + <part class="input"> + <password name="act_password" class="focus"></password> + </part> </part> - <part class="input"> - <password name="act_password" class="focus"></password> + </group> + <group title="message:user_new_password"> + <part class="line"> + <part class="label"> + <label for="password1"> + <text text="user_new_password"></text> + </label> + </part> + <part class="input"> + <password name="password1"></password> + </part> </part> - </part> - </group> - <group title="message:user_new_password"> - <part class="line"> - <part class="label"> - <label for="password1"> - <text text="user_new_password"></text> - </label> + <part class="line"> + <part class="label"> + <label for="password2"> + <text text="user_new_password_repeat"></text> + </label> + </part> + <part class="input"> + <password name="password2"></password> + </part> </part> - <part class="input"> - <password name="password1"></password> - </part> - </part> - <part class="line"> - <part class="label"> - <label for="password2"> - <text text="user_new_password_repeat"></text> - </label> - </part> - <part class="input"> - <password name="password2"></password> - </part> - </part> - </group> + </group> + </if> + <else> + <text class="warn" key="change_not_allowed" /> + </else> </form> </output> \ No newline at end of file