changed how the "remember me" checkbox is handled
This commit is contained in:
parent
7902dea5f3
commit
8f30d80b38
|
@ -71,8 +71,7 @@
|
||||||
<input class="js-remember-checkbox hidden" type="checkbox"></input>
|
<input class="js-remember-checkbox hidden" type="checkbox"></input>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<!-- <button class="dap-full-button-green js-remember-btn js-authz-remember-me">SIGN IN ONCE</button> -->
|
<button type="submit" class="btn btn-primary submit-btn dap-full-button-green js-submit-code-btn" disabled>Submit</button>
|
||||||
<button type="submit" class="btn btn-primary submit-btn dap-full-button-green js-remember-btn js-authz-remember-me" disabled>Submit</button>
|
|
||||||
<!-- <a href="./authnocode.html" target="_blank" class="btn btn-primary">Send Code Again</a> -->
|
<!-- <a href="./authnocode.html" target="_blank" class="btn btn-primary">Send Code Again</a> -->
|
||||||
<button class="btn btn-primary js-edit-email-button" type="button">Edit My Email</button>
|
<button class="btn btn-primary js-edit-email-button" type="button">Edit My Email</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -146,11 +145,11 @@
|
||||||
<script src="./js/jquery-2.2.0.min.js"></script>
|
<script src="./js/jquery-2.2.0.min.js"></script>
|
||||||
<script src="./js/jquery.mask.min.js"></script>
|
<script src="./js/jquery.mask.min.js"></script>
|
||||||
<script src="./js/bootstrap.min.js"></script>
|
<script src="./js/bootstrap.min.js"></script>
|
||||||
|
<script src="/assets/org.oauth3/oauth3.core.js"></script>
|
||||||
|
<script src="/assets/org.oauth3/oauth3.crypto.js"></script>
|
||||||
|
<script src="/assets/org.oauth3/oauth3.issuer.js"></script>
|
||||||
<script src="./js/issuer.js"></script>
|
<script src="./js/issuer.js"></script>
|
||||||
<script src="./js/script.js"></script>
|
<script src="./js/script.js"></script>
|
||||||
<script src="/assets/org.oauth3/oauth3.core.js"></script>
|
|
||||||
<script src="/assets/org.oauth3/oauth3.issuer.js"></script>
|
|
||||||
<!--script src="/assets/org.oauth3/oauth3.mock.js"></script-->
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
38
js/issuer.js
38
js/issuer.js
|
@ -20,16 +20,6 @@ $(function () {
|
||||||
};
|
};
|
||||||
$('.js-scopes-container').html('');
|
$('.js-scopes-container').html('');
|
||||||
|
|
||||||
OAUTH3._hooks = { sessions: {} };
|
|
||||||
OAUTH3._hooks.sessions.get = function (providerUri, id) {
|
|
||||||
return JSON.parse(window.localStorage.getItem('session-' + providerUri + (id || '')) || 'null');
|
|
||||||
};
|
|
||||||
OAUTH3._hooks.sessions.set = function (providerUri, newSession, id) {
|
|
||||||
window.localStorage.setItem('session-' + providerUri, JSON.stringify(newSession));
|
|
||||||
window.localStorage.setItem('session-' + providerUri + (id || newSession.id || newSession.token.id || ''), JSON.stringify(newSession));
|
|
||||||
return newSession;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO let query.parse do location.hash || location.search || location
|
// TODO let query.parse do location.hash || location.search || location
|
||||||
var clientParams = OAUTH3.query.parse(loc.hash || loc.search);
|
var clientParams = OAUTH3.query.parse(loc.hash || loc.search);
|
||||||
if (/authorization_dialog/.test(window.location.href)) {
|
if (/authorization_dialog/.test(window.location.href)) {
|
||||||
|
@ -222,26 +212,11 @@ $(function () {
|
||||||
$('.js-user-email').text(email);
|
$('.js-user-email').text(email);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
util.rememberDevice = function (ev) {
|
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
|
|
||||||
util.submitLoginCode({
|
|
||||||
rememberDevice: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
util.rememberDeviceNot = function (ev) {
|
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
|
|
||||||
util.submitLoginCode({
|
|
||||||
rememberDevice: false
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// Reference Implementation
|
// Reference Implementation
|
||||||
|
util.submitLoginCode = function (ev) {
|
||||||
util.submitLoginCode = function (opts) {
|
ev.preventDefault();
|
||||||
|
ev.stopPropagation();
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// perhaps we should check that the code is valid before continuing to login (so that we don't send the key)
|
// perhaps we should check that the code is valid before continuing to login (so that we don't send the key)
|
||||||
|
@ -249,7 +224,6 @@ $(function () {
|
||||||
// TODO
|
// TODO
|
||||||
// we should be sending the public key for this device as a jwk along with the authentication
|
// we should be sending the public key for this device as a jwk along with the authentication
|
||||||
// (and how long to remember this device)
|
// (and how long to remember this device)
|
||||||
|
|
||||||
var uuid = $('.js-authn-otp-uuid').val();
|
var uuid = $('.js-authn-otp-uuid').val();
|
||||||
var code = $('.js-authn-otp-code').val().trim();
|
var code = $('.js-authn-otp-code').val().trim();
|
||||||
return OAUTH3.authn.resourceOwnerPassword(CONFIG.directives, {
|
return OAUTH3.authn.resourceOwnerPassword(CONFIG.directives, {
|
||||||
|
@ -263,7 +237,7 @@ $(function () {
|
||||||
// TODO should be otp_id (agnostic of uuid)
|
// TODO should be otp_id (agnostic of uuid)
|
||||||
, otp_uuid: uuid
|
, otp_uuid: uuid
|
||||||
// add expiration to the refresh token and/or public key
|
// add expiration to the refresh token and/or public key
|
||||||
, expire: opts.rememberDevice || (1 * 60 * 60 * 1000)
|
, remember_device: $('.js-remember-label').find('.js-remember-checkbox').prop('checked')
|
||||||
, mock: true
|
, mock: true
|
||||||
}).then(function (session) {
|
}).then(function (session) {
|
||||||
$('.js-authn').removeClass('in').hide();
|
$('.js-authn').removeClass('in').hide();
|
||||||
|
@ -344,7 +318,6 @@ $(function () {
|
||||||
util.editEmail = function () {
|
util.editEmail = function () {
|
||||||
$('.js-authn').hide();
|
$('.js-authn').hide();
|
||||||
$('.js-userid-container').show();
|
$('.js-userid-container').show();
|
||||||
debugger;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -359,8 +332,7 @@ $(function () {
|
||||||
|
|
||||||
$('body').on('click', '.js-logout', util.handleLogout);
|
$('body').on('click', '.js-logout', util.handleLogout);
|
||||||
$('body').on('click', '.js-authn-show', util.submitAuthEmail);
|
$('body').on('click', '.js-authn-show', util.submitAuthEmail);
|
||||||
$('body').on('click', '.js-authz-remember-me', util.rememberDevice);
|
$('body').on('click', '.js-submit-code-btn', util.submitLoginCode);
|
||||||
$('body').on('click', '.js-authz-remember-me-not', util.rememberDeviceNot);
|
|
||||||
$('body').on('click', '.js-login-allow', util.acceptScopesAndLogin);
|
$('body').on('click', '.js-login-allow', util.acceptScopesAndLogin);
|
||||||
$('body').on('click', '.js-login-deny', util.closeLoginDeny);
|
$('body').on('click', '.js-login-deny', util.closeLoginDeny);
|
||||||
$('body').on('click', '.js-edit-email-button', util.editEmail);
|
$('body').on('click', '.js-edit-email-button', util.editEmail);
|
||||||
|
|
Loading…
Reference in New Issue