Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit b3b5950

Browse files
author
sachin-maheshwari
authored
Merge pull request #356 from appirio-tech/dev
New Auth0 Flow and bug fixes
2 parents 70875b6 + 627eaab commit b3b5950

File tree

5 files changed

+44
-6
lines changed

5 files changed

+44
-6
lines changed

Diff for: .circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ workflows:
9999
context : org-global
100100
filters:
101101
branches:
102-
only: [ dev, "new_ui_style"]
102+
only: [ dev, "new_ui_style", 'feature/RS256-backward-compatibility']
103103
- build-qa:
104104
context : org-global
105105
filters:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import angular from 'angular'
2+
3+
(function () {
4+
'use strict'
5+
6+
angular.module('accounts.directives').directive('validConfirmPassword', validConfirmPassword)
7+
8+
function validConfirmPassword() {
9+
return {
10+
require: 'ngModel',
11+
link: function (scope, element, attrs, ctrl) {
12+
ctrl.$validators.validConfirmPassword = function (modelValue, viewValue) {
13+
if (modelValue === ctrl.$$parentForm.password.$modelValue) {
14+
return true
15+
}
16+
return false
17+
}
18+
}
19+
}
20+
}
21+
})()

Diff for: app/views/directives/toggle-confirm-password.directive.jade

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
aria-describedby="tp-help-password",
1919
aria-required="false",
2020
class="input input-btn {{ vm.hasPasswordError() ? 'error' : ''}}"
21-
required)
21+
required,
22+
valid-confirm-password
23+
)
2224

2325
button.tc-btn.tc-btn-sm.show-password-btn(type="button", id="toggleInputTypeBtn", tabIndex="0", ng-click="vm.toggleTypeAttribute()")
2426
img(src=logoViewPassword, alt="View Password")

Diff for: app/views/tc/register.jade

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104

105105
p.form-error(ng-message="required" role="alert") Please enter an email address.
106106

107-
.validation-bar
107+
.validation-bar(ng-class="{ 'error-bar': (vm.registerForm.password.$dirty && vm.registerForm.password.$invalid) }")
108108
md-input-container.md-block
109109
label(for="password-input") Password
110110
toggle-password-with-tips(ng-if="!vm.isSocialRegistration && !vm.ssoForced && !vm.ssoUser")
@@ -121,7 +121,7 @@
121121

122122
p(ng-class="{ 'has-symbol-or-number': (vm.registerForm.password.$dirty && !vm.registerForm.password.$error.hasSymbolOrNumber) }") At least one number or symbol
123123

124-
.validation-bar.confirm-password
124+
.validation-bar.confirm-password(ng-class="{ 'error-bar': (vm.registerForm.confirmPassword.$dirty && vm.registerForm.confirmPassword.$invalid) }")
125125
md-input-container.md-block
126126
label(for="confirm-password-input") Confirm password
127127
toggle-confirm-password(ng-if="!vm.isSocialRegistration && !vm.ssoForced && !vm.ssoUser")

Diff for: core/token.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { V3_JWT, AUTH0_REFRESH, AUTH0_JWT, V2_JWT, V2_SSO, ZENDESK_JWT, DOMAIN } from './constants.js'
22
import fromPairs from 'lodash/fromPairs'
3+
import _ from 'lodash'
34

45
export function clearTokens() {
56
removeToken(V3_JWT)
@@ -34,8 +35,22 @@ export function decodeToken(token) {
3435
if (!decoded) {
3536
throw new Error('Cannot decode the token')
3637
}
37-
38-
return JSON.parse(decoded)
38+
39+
// covert base64 token in JSON object
40+
let t = JSON.parse(decoded)
41+
42+
// tweaking for custom claim for RS256 id-token
43+
t.userId = _.parseInt(_.find(t, (value, key) => {
44+
return (key.indexOf('userId') !== -1)
45+
}))
46+
t.handle = _.find(t, (value, key) => {
47+
return (key.indexOf('handle') !== -1)
48+
})
49+
t.roles = _.find(t, (value, key) => {
50+
return (key.indexOf('roles') !== -1)
51+
})
52+
53+
return t
3954
}
4055

4156
export function isTokenExpired(token, offsetSeconds = 0) {

0 commit comments

Comments
 (0)