global $wgLang, $wgAllowRealName, $wgEnableEmail;
global $wgAuth;
+ $this->mType = $request->getText( 'type' );
$this->mName = $request->getText( 'wpName' );
$this->mPassword = $request->getText( 'wpPassword' );
$this->mRetype = $request->getText( 'wpRetype' );
*/
function addNewAccountInternal() {
global $wgUser, $wgOut;
- global $wgUseLatin1, $wgEnableSorbs, $wgProxyWhitelist;
+ global $wgEnableSorbs, $wgProxyWhitelist;
global $wgMemc, $wgAccountCreationThrottle, $wgDBname;
global $wgAuth, $wgMinimalPasswordLength;
}
if (!$u->checkPassword( $this->mPassword )) {
- $this->mainLoginForm( wfMsg( 'wrongpassword' ) );
+ $this->mainLoginForm( wfMsg( $this->mPassword == '' ? 'wrongpasswordempty' : 'wrongpassword' ) );
return;
}
* @access private
*/
function mailPassword() {
- global $wgUser, $wgDeferredUpdateList, $wgOutputEncoding;
- global $wgCookiePath, $wgCookieDomain, $wgDBname;
+ global $wgUser, $wgDBname;
if ( '' == $this->mName ) {
$this->mainLoginForm( wfMsg( 'noname' ) );
if( WikiError::isError( $result ) ) {
$this->mainLoginForm( wfMsg( 'mailerror', $result->getMessage() ) );
} else {
- $this->mainLoginForm( wfMsg( 'passwordsent', $u->getName() ) );
+ $this->mainLoginForm( wfMsg( 'passwordsent', $u->getName() ), 'success' );
}
}
* @access private
*/
function mailPasswordInternal( $u ) {
- global $wgPasswordSender, $wgDBname;
- global $wgCookiePath, $wgCookieDomain;
+ global $wgDBname, $wgCookiePath, $wgCookieDomain;
if ( '' == $u->getEmail() ) {
return wfMsg( 'noemail', $u->getName() );
/**
* @access private
*/
- function mainLoginForm( $err ) {
+ function mainLoginForm( $msg, $msgtype = 'error' ) {
global $wgUser, $wgOut, $wgLang;
global $wgDBname, $wgAllowRealName, $wgEnableEmail;
global $wgAuth;
}
}
- $q = 'action=submitlogin';
- if ( !empty( $this->mReturnto ) ) {
- $q .= '&returnto=' . wfUrlencode( $this->mReturnto );
- }
$titleObj = Title::makeTitle( NS_SPECIAL, 'Userlogin' );
require_once( 'templates/Userlogin.php' );
- $template =& new UserloginTemplate();
+
+ if ( $this->mType == 'signup' ) {
+ $template =& new UsercreateTemplate();
+ $q = 'action=submitlogin&type=signup';
+ $linkq = 'type=login';
+ $linkmsg = 'gotaccount';
+ } else {
+ $template =& new UserloginTemplate();
+ $q = 'action=submitlogin&type=login';
+ $linkq = 'type=signup';
+ $linkmsg = 'nologin';
+ }
+
+ if ( !empty( $this->mReturnto ) ) {
+ $returnto = '&returnto=' . wfUrlencode( $this->mReturnto );
+ $q .= $returnto;
+ $linkq .= $returnto;
+ }
+
+ $link = '<a href="' . htmlspecialchars ( $titleObj->getLocalUrl( $linkq ) ) . '">';
+ $link .= wfMsgHtml( $linkmsg . 'link' );
+ $link .= '</a>';
+
+ $template->set( 'link', wfMsgHtml( $linkmsg, $link ) );
$template->set( 'name', $this->mName );
$template->set( 'password', $this->mPassword );
$template->set( 'domain', $this->mDomain );
$template->set( 'action', $titleObj->getLocalUrl( $q ) );
- $template->set( 'error', $err );
+ $template->set( 'message', $msg );
+ $template->set( 'messagetype', $msgtype );
$template->set( 'create', $wgUser->isAllowedToCreateAccount() );
$template->set( 'createemail', $wgEnableEmail && $wgUser->isLoggedIn() );
$template->set( 'userealname', $wgAllowRealName );