Go to the documentation of this file.
42 if ( $params[
'user'] ===
null ) {
43 $params[
'user'] = $this->
getUser()->getName();
49 if ( $user ===
false ) {
54 if ( $user->pingLimiter(
'badoath', 0 ) ) {
65 if ( !$user->isAnon() ) {
67 $authUser = $userRepo->findByUser( $user );
69 $module = $authUser->getModule();
70 if ( $module instanceof
IModule ) {
72 if ( isset( $params[
'totp'] ) ) {
74 if ( $module instanceof
TOTP ) {
76 'token' => $params[
'totp']
81 if ( is_array( $decoded ) ) {
85 $result[
'enabled'] = $module->isEnabled( $authUser );
86 $result[
'valid'] = $module->verify( $authUser, $data ) !==
false;
87 $result[
'module'] = $module->getName();
124 'action=oathvalidate&totp=123456&token=123ABC'
125 =>
'apihelp-oathvalidate-example-1',
126 'action=oathvalidate&user=Example&totp=123456&token=123ABC'
127 =>
'apihelp-oathvalidate-example-2',
128 'action=oathvalidate&user=Example&data={"totp":"123456"}&token=123ABC'
129 =>
'apihelp-oathvalidate-example-3',
dieWithError( $msg, $code=null, $data=null, $httpCode=null)
Abort execution with an error.
const PARAM_TYPE
(string|string[]) Either an array of allowed value strings, or a string type as described below.
getResult()
Get the result object.
checkUserRightsAny( $rights, $user=null)
Helper function for permission-denied errors.
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
This abstract class implements many basic API functions, and is the base of all API classes.
const PARAM_DEPRECATED
(boolean) Is the parameter deprecated (will show a warning)?
This class represents the result of the API operations.
const META_BC_BOOLS
Key for the 'BC bools' metadata item.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
requireAtLeastOneParameter( $params, $required)
Die if none of a certain set of parameters is set and not false.
getModuleName()
Get the name of the module being executed by this instance.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
requirePostedParameters( $params, $prefix='prefix')
Die if any of the specified parameters were found in the query part of the URL rather than the post b...