parent
08b804998a
commit
c105e0c627
@ -57,7 +57,7 @@ dummyLogin = AuthPlugin{..}
|
|||||||
{ formMethod = POST
|
{ formMethod = POST
|
||||||
, formAction = Just . SomeRoute . toMaster $ PluginR "dummy" []
|
, formAction = Just . SomeRoute . toMaster $ PluginR "dummy" []
|
||||||
, formEncoding = loginEnctype
|
, formEncoding = loginEnctype
|
||||||
, formAttrs = []
|
, formAttrs = [("uw-no-navigate-away-prompt","")]
|
||||||
, formSubmit = FormSubmit
|
, formSubmit = FormSubmit
|
||||||
, formAnchor = Just "login--dummy" :: Maybe Text
|
, formAnchor = Just "login--dummy" :: Maybe Text
|
||||||
}
|
}
|
||||||
|
|||||||
@ -117,7 +117,7 @@ campusLogin conf@LdapConf{..} pool = AuthPlugin{..}
|
|||||||
{ formMethod = POST
|
{ formMethod = POST
|
||||||
, formAction = Just . SomeRoute . toMaster $ PluginR "LDAP" []
|
, formAction = Just . SomeRoute . toMaster $ PluginR "LDAP" []
|
||||||
, formEncoding = loginEnctype
|
, formEncoding = loginEnctype
|
||||||
, formAttrs = []
|
, formAttrs = [("uw-no-navigate-away-prompt","")]
|
||||||
, formSubmit = FormSubmit
|
, formSubmit = FormSubmit
|
||||||
, formAnchor = Just "login--campus" :: Maybe Text
|
, formAnchor = Just "login--campus" :: Maybe Text
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,7 @@ hashLogin pwHashAlgo = AuthPlugin{..}
|
|||||||
{ formMethod = POST
|
{ formMethod = POST
|
||||||
, formAction = Just . SomeRoute . toMaster $ PluginR "PWHash" []
|
, formAction = Just . SomeRoute . toMaster $ PluginR "PWHash" []
|
||||||
, formEncoding = loginEnctype
|
, formEncoding = loginEnctype
|
||||||
, formAttrs = []
|
, formAttrs = [("uw-no-navigate-away-prompt","")]
|
||||||
, formSubmit = FormSubmit
|
, formSubmit = FormSubmit
|
||||||
, formAnchor = Just "login--hash" :: Maybe Text
|
, formAnchor = Just "login--hash" :: Maybe Text
|
||||||
}
|
}
|
||||||
|
|||||||
@ -257,6 +257,7 @@
|
|||||||
*
|
*
|
||||||
* Attribute: [none]
|
* Attribute: [none]
|
||||||
* (automatically setup on all form tags that dont automatically submit, see AutoSubmitButtonUtil)
|
* (automatically setup on all form tags that dont automatically submit, see AutoSubmitButtonUtil)
|
||||||
|
* Does not setup on forms that have uw-no-navigate-away-prompt
|
||||||
*
|
*
|
||||||
* Example usage:
|
* Example usage:
|
||||||
* (any page with a form)
|
* (any page with a form)
|
||||||
@ -264,6 +265,7 @@
|
|||||||
|
|
||||||
var NAVIGATE_AWAY_PROMPT_UTIL_NAME = 'navigateAwayPrompt';
|
var NAVIGATE_AWAY_PROMPT_UTIL_NAME = 'navigateAwayPrompt';
|
||||||
var NAVIGATE_AWAY_PROMPT_UTIL_SELECTOR = 'form';
|
var NAVIGATE_AWAY_PROMPT_UTIL_SELECTOR = 'form';
|
||||||
|
var NAVIGATE_AWAY_PROMPT_UTIL_OPTOUT = '[uw-no-navigate-away-prompt]';
|
||||||
|
|
||||||
var NAVIGATE_AWAY_PROMPT_INITIALIZED_CLASS = 'navigate-away-prompt--initialized';
|
var NAVIGATE_AWAY_PROMPT_INITIALIZED_CLASS = 'navigate-away-prompt--initialized';
|
||||||
|
|
||||||
@ -285,6 +287,10 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (element.matches(NAVIGATE_AWAY_PROMPT_UTIL_OPTOUT)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
window.addEventListener('beforeunload', beforeUnloadHandler);
|
window.addEventListener('beforeunload', beforeUnloadHandler);
|
||||||
|
|
||||||
element.addEventListener('submit', function() {
|
element.addEventListener('submit', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user