dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "MimeAnalyzer: Add testcases for mp3 detection"
[lhc/web/wiklou.git]
/
includes
/
auth
/
AuthenticationResponse.php
diff --git
a/includes/auth/AuthenticationResponse.php
b/includes/auth/AuthenticationResponse.php
index
0339e45
..
956c985
100644
(file)
--- a/
includes/auth/AuthenticationResponse.php
+++ b/
includes/auth/AuthenticationResponse.php
@@
-81,6
+81,9
@@
class AuthenticationResponse {
/** @var Message|null I18n message to display in case of UI or FAIL */
public $message = null;
/** @var Message|null I18n message to display in case of UI or FAIL */
public $message = null;
+ /** @var string Whether the $message is an error or warning message, for styling reasons */
+ public $messageType = 'warning';
+
/**
* @var string|null Local user name from authentication.
* May be null if the authentication passed but no local user is known.
/**
* @var string|null Local user name from authentication.
* May be null if the authentication passed but no local user is known.
@@
-130,7
+133,7
@@
class AuthenticationResponse {
*/
public static function newPass( $username = null ) {
$ret = new AuthenticationResponse;
*/
public static function newPass( $username = null ) {
$ret = new AuthenticationResponse;
- $ret->status =
AuthenticationResponse
::PASS;
+ $ret->status =
self
::PASS;
$ret->username = $username;
return $ret;
}
$ret->username = $username;
return $ret;
}
@@
-142,8
+145,9
@@
class AuthenticationResponse {
*/
public static function newFail( Message $msg ) {
$ret = new AuthenticationResponse;
*/
public static function newFail( Message $msg ) {
$ret = new AuthenticationResponse;
- $ret->status =
AuthenticationResponse
::FAIL;
+ $ret->status =
self
::FAIL;
$ret->message = $msg;
$ret->message = $msg;
+ $ret->messageType = 'error';
return $ret;
}
return $ret;
}
@@
-154,7
+158,7
@@
class AuthenticationResponse {
*/
public static function newRestart( Message $msg ) {
$ret = new AuthenticationResponse;
*/
public static function newRestart( Message $msg ) {
$ret = new AuthenticationResponse;
- $ret->status =
AuthenticationResponse
::RESTART;
+ $ret->status =
self
::RESTART;
$ret->message = $msg;
return $ret;
}
$ret->message = $msg;
return $ret;
}
@@
-165,25
+169,30
@@
class AuthenticationResponse {
*/
public static function newAbstain() {
$ret = new AuthenticationResponse;
*/
public static function newAbstain() {
$ret = new AuthenticationResponse;
- $ret->status =
AuthenticationResponse
::ABSTAIN;
+ $ret->status =
self
::ABSTAIN;
return $ret;
}
/**
* @param AuthenticationRequest[] $reqs AuthenticationRequests needed to continue
* @param Message $msg
return $ret;
}
/**
* @param AuthenticationRequest[] $reqs AuthenticationRequests needed to continue
* @param Message $msg
+ * @param string $msgtype
* @return AuthenticationResponse
* @see AuthenticationResponse::UI
*/
* @return AuthenticationResponse
* @see AuthenticationResponse::UI
*/
- public static function newUI( array $reqs, Message $msg ) {
+ public static function newUI( array $reqs, Message $msg
, $msgtype = 'warning'
) {
if ( !$reqs ) {
throw new \InvalidArgumentException( '$reqs may not be empty' );
}
if ( !$reqs ) {
throw new \InvalidArgumentException( '$reqs may not be empty' );
}
+ if ( $msgtype !== 'warning' && $msgtype !== 'error' ) {
+ throw new \InvalidArgumentException( $msgtype . ' is not a valid message type.' );
+ }
$ret = new AuthenticationResponse;
$ret = new AuthenticationResponse;
- $ret->status =
AuthenticationResponse
::UI;
+ $ret->status =
self
::UI;
$ret->neededRequests = $reqs;
$ret->message = $msg;
$ret->neededRequests = $reqs;
$ret->message = $msg;
+ $ret->messageType = $msgtype;
return $ret;
}
return $ret;
}
@@
-200,7
+209,7
@@
class AuthenticationResponse {
}
$ret = new AuthenticationResponse;
}
$ret = new AuthenticationResponse;
- $ret->status =
AuthenticationResponse
::REDIRECT;
+ $ret->status =
self
::REDIRECT;
$ret->neededRequests = $reqs;
$ret->redirectTarget = $redirectTarget;
$ret->redirectApiData = $redirectApiData;
$ret->neededRequests = $reqs;
$ret->redirectTarget = $redirectTarget;
$ret->redirectApiData = $redirectApiData;