diff --git a/app/update-password/controller.js b/app/update-password/controller.js index e0172a7de..43f23f79e 100644 --- a/app/update-password/controller.js +++ b/app/update-password/controller.js @@ -1,14 +1,25 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; -import { get } from '@ember/object'; +import { get, computed } from '@ember/object'; import C from 'ui/utils/constants'; export default Controller.extend({ router: service(), + access: service(), + showCurrent: computed('access.userCode.password', function() { + if (get(this, 'access.userCode.password')) { + return false; + } + return true; + }), + currentPassword: computed('', function() { + return get(this, 'access.userCode.password') || null; + }), complete(success) { let backTo = get(this, 'session').get(C.SESSION.BACK_TO) let router = get(this, 'router'); if (success) { + get(this, 'access').set('userCode', null); if ( backTo ) { // console.log('Going back to', backTo); window.location.href = backTo; diff --git a/app/update-password/route.js b/app/update-password/route.js index 8dfbeb759..6aa686d73 100644 --- a/app/update-password/route.js +++ b/app/update-password/route.js @@ -15,7 +15,8 @@ export default Route.extend({ model: function() { return { - user: get(this, 'access.me') + user: get(this, 'access.me'), + code: get(this, 'access.userCode')||'', }; }, }); diff --git a/app/update-password/template.hbs b/app/update-password/template.hbs index c8d98fe65..0d0a2dcd1 100644 --- a/app/update-password/template.hbs +++ b/app/update-password/template.hbs @@ -6,7 +6,8 @@ {{input-edit-password complete=(action (action complete)) user=model.user - showCurrent=true + showCurrent=showCurrent + currentPassword=currentPassword cancelDisabled=true }} \ No newline at end of file diff --git a/lib/login/addon/login/controller.js b/lib/login/addon/login/controller.js index 8bcf7d4d2..93c3dc55c 100644 --- a/lib/login/addon/login/controller.js +++ b/lib/login/addon/login/controller.js @@ -108,12 +108,14 @@ export default Controller.extend({ get(this, 'access').login(provider, code).then((user) => { if ( get(user, 'mustChangePassword') && provider === 'local' ) { get(this,'session').set(C.SESSION.BACK_TO, window.location.origin); + get(this, 'access').set('userCode', code); get(this, 'router').transitionTo('update-password'); } else { setProperties(this, { user: null, code: null, }); + get(this, 'access').set('userCode', null); this.send('complete', true); } }).catch((err) => { diff --git a/lib/shared/addon/access/service.js b/lib/shared/addon/access/service.js index 596ff4478..04764089b 100644 --- a/lib/shared/addon/access/service.js +++ b/lib/shared/addon/access/service.js @@ -18,6 +18,7 @@ export default Service.extend({ app: service(), me: null, + userCode: null, // These are set by authenticated/route // Is access control enabled diff --git a/lib/shared/addon/components/settings/server-url/template.hbs b/lib/shared/addon/components/settings/server-url/template.hbs index 9fdfc5277..4b3e61d2d 100644 --- a/lib/shared/addon/components/settings/server-url/template.hbs +++ b/lib/shared/addon/components/settings/server-url/template.hbs @@ -1,7 +1,7 @@ {{#if showHeader}}

{{t 'serverUrl.header.label'}}

-

{{t 'serverUrl.header.detail'}}

+

{{t 'serverUrl.header.detail' appName=settings.appName}}

{{/if}}
diff --git a/translations/en-us.yaml b/translations/en-us.yaml index 2d5384926..f77f6e584 100644 --- a/translations/en-us.yaml +++ b/translations/en-us.yaml @@ -5029,7 +5029,7 @@ serviceLog: serverUrl: header: label: Rancher Server URL - detail: TBD + detail: "What URL should be used for this {appName} installation? All the nodes in your clusters will need to be able to reach this." button: save: Save URL