Changeset 1330
- Timestamp:
- 03/02/08 14:24:55 (7 months ago)
- Files:
-
- trunk/wifidog-auth/CHANGELOG (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Authenticator.php (modified) (2 diffs)
- trunk/wifidog-auth/wifidog/classes/Authenticators/AuthenticatorLocalUser.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/classes/Authenticators/AuthenticatorLocalUserNoSignup.php (modified) (1 diff)
- trunk/wifidog-auth/wifidog/templates/classes/Authenticator_getLoginForm.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wifidog-auth/CHANGELOG
r1329 r1330 1 1 # $Id$ 2 2008-03-02 Benoit Grégoire <bock@step.polymtl.ca> 3 * Fix #431: Don't even display the Signup button if none of the networks allow signing up. Allow Authenticators to define the signup URL themselves. 2 4 3 5 2008-02-27 Damien Raude-Morvan <drazzib@drazzib.com> trunk/wifidog-auth/wifidog/classes/Authenticator.php
r1304 r1330 151 151 $smarty->assign('error', self::$_loginLastError); 152 152 153 // Check if one of the network allow signup 154 $network_array=Network::getAllNetworks(); 155 156 $networksAllowingSignup = null; 157 foreach ($network_array as $network) { 158 if ($network->getAuthenticator()->isRegistrationPermitted()) { 159 $networksAllowingSignup[] = $network; 160 } 161 } 162 //pretty_print_r($networksAllowingSignup); 163 if (count($networksAllowingSignup)>0){ 164 //FIXME: This is far from ideal, it assumes that all networks use the same signup URL, or that only one network allows signup. 165 $smarty->assign('signupUrl', $networksAllowingSignup[0]->getAuthenticator()->getSignupUrl()); 166 } 153 167 // Compile HTML code 154 $html = self::ArrayToHiddenInput($_POST);//This must remain BEFORE the actual form 168 $html = self::ArrayToHiddenInput($_POST);//This must remain BEFORE the actual form. It allws repeating the request if the login attempt is causes by a session timeout or insufficient permissions. 155 169 $html .= $smarty->fetch("templates/classes/Authenticator_getLoginForm.tpl"); 156 170 return $html; … … 342 356 * @return bool Returns if the class allows registration 343 357 */ 344 public function isRegistrationPermitted() 345 { 346 return false; 347 } 348 358 final public function isRegistrationPermitted() 359 { 360 return $this->getSignupUrl()?true:false; 361 } 362 /** 363 * If the authenticator allows new users to register new account, this must return the URL at which they must do so. 364 * 365 * @return text The URL to register at or NULL. NULL means that the Authenticator does not allow new users to self-register. 366 */ 367 public function getSignupUrl() 368 { 369 return null; 370 } 349 371 } 350 372 trunk/wifidog-auth/wifidog/classes/Authenticators/AuthenticatorLocalUser.php
r1304 r1330 208 208 209 209 /** 210 * The basic AuthenticatorLocalUser allows user signup211 * 212 * @return bool Returns if the class allows registration213 */ 214 public function isRegistrationPermitted()215 { 216 return true;210 * If the authenticator allows new users to register new account, this must return the URL at which they must do so. 211 * 212 * @return text The URL to register at or NULL. NULL means that the Authenticator does not allow new users to self-register. 213 */ 214 public function getSignupUrl() 215 { 216 return BASE_NON_SSL_PATH.'signup.php'; 217 217 } 218 218 trunk/wifidog-auth/wifidog/classes/Authenticators/AuthenticatorLocalUserNoSignup.php
r1090 r1330 60 60 { 61 61 /** 62 * The AuthenticatorLocalUserNoSignup does not allow user signup62 * If the authenticator allows new users to register new account, this must return the URL at which they must do so. 63 63 * 64 * @return bool Returns if the class allows registration64 * @return text The URL to register at or NULL. NULL means that the Authenticator does not allow new users to self-register. 65 65 */ 66 function isRegistrationPermitted()66 public function getSignupUrl() 67 67 { 68 return false;68 return null; 69 69 } 70 70 trunk/wifidog-auth/wifidog/templates/classes/Authenticator_getLoginForm.tpl
r1297 r1330 68 68 69 69 <input class="submit" type="submit" tabindex="3" name="login_form_submit" value="{"Login"|_}" onclick="return validateForm(this.form);"/> 70 <input class="submit" type="submit" tabindex="4" name="form_signup" value="{"Create a free account"|_}" onclick="location.href='{$base_ssl_path}signup.php';" /> 71 <script type="text/javascript"> 70 {if $signupUrl} 71 <input class="submit" type="submit" tabindex="4" name="form_signup" value="{"Create a free account"|_}" onclick="location.href='{$signupUrl}';" /> 72 {/if} 73 <script type="text/javascript"> 72 74 <!-- 73 75 {literal}
