Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4122115
special.changecredentials.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
special.changecredentials.js
View Options
/*!
* JavaScript for change credentials form.
*/
(
function
()
{
mw
.
hook
(
'htmlform.enhance'
).
add
(
(
$root
)
=>
{
const
api
=
new
mw
.
Api
();
$root
.
find
(
'.mw-changecredentials-validate-password.oo-ui-fieldLayout'
).
each
(
function
()
{
const
self
=
OO
.
ui
.
FieldLayout
.
static
.
infuse
(
$
(
this
)
);
let
currentApiPromise
;
self
.
getField
().
setValidation
(
(
passwordValue
)
=>
{
if
(
currentApiPromise
)
{
currentApiPromise
.
abort
();
currentApiPromise
=
undefined
;
}
passwordValue
=
passwordValue
.
trim
();
if
(
passwordValue
===
''
)
{
self
.
setErrors
(
[]
);
return
true
;
}
const
d
=
$
.
Deferred
();
currentApiPromise
=
api
.
post
(
{
action
:
'validatepassword'
,
password
:
passwordValue
,
formatversion
:
2
,
errorformat
:
'html'
,
errorsuselocal
:
true
,
uselang
:
mw
.
config
.
get
(
'wgUserLanguage'
)
}
).
done
(
(
resp
)
=>
{
const
pwinfo
=
resp
.
validatepassword
,
good
=
pwinfo
.
validity
===
'Good'
;
currentApiPromise
=
undefined
;
let
errors
;
if
(
!
good
)
{
errors
=
pwinfo
.
validitymessages
.
map
(
(
m
)
=>
new
OO
.
ui
.
HtmlSnippet
(
m
.
html
)
);
}
self
.
setErrors
(
errors
||
[]
);
d
.
resolve
(
good
);
}
).
fail
(
d
.
reject
);
return
d
.
promise
(
{
abort
:
currentApiPromise
.
abort
}
);
}
);
}
);
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 05:09 (1 d, 15 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d2/ed/4afafe1f0e113112020fed9e7dd1
Default Alt Text
special.changecredentials.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment