Merge pull request #1764 from westlywright/tech-preview

Tech preview
This commit is contained in:
Vincent Fiduccia 2018-03-26 16:25:37 -07:00 committed by GitHub
commit 000dfc47ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 5 deletions

View File

@ -1,14 +1,25 @@
import Controller from '@ember/controller'; import Controller from '@ember/controller';
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import { get } from '@ember/object'; import { get, computed } from '@ember/object';
import C from 'ui/utils/constants'; import C from 'ui/utils/constants';
export default Controller.extend({ export default Controller.extend({
router: service(), 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) { complete(success) {
let backTo = get(this, 'session').get(C.SESSION.BACK_TO) let backTo = get(this, 'session').get(C.SESSION.BACK_TO)
let router = get(this, 'router'); let router = get(this, 'router');
if (success) { if (success) {
get(this, 'access').set('userCode', null);
if ( backTo ) { if ( backTo ) {
// console.log('Going back to', backTo); // console.log('Going back to', backTo);
window.location.href = backTo; window.location.href = backTo;

View File

@ -15,7 +15,8 @@ export default Route.extend({
model: function() { model: function() {
return { return {
user: get(this, 'access.me') user: get(this, 'access.me'),
code: get(this, 'access.userCode')||'',
}; };
}, },
}); });

View File

@ -6,7 +6,8 @@
{{input-edit-password {{input-edit-password
complete=(action (action complete)) complete=(action (action complete))
user=model.user user=model.user
showCurrent=true showCurrent=showCurrent
currentPassword=currentPassword
cancelDisabled=true cancelDisabled=true
}} }}
</div> </div>

View File

@ -108,12 +108,14 @@ export default Controller.extend({
get(this, 'access').login(provider, code).then((user) => { get(this, 'access').login(provider, code).then((user) => {
if ( get(user, 'mustChangePassword') && provider === 'local' ) { if ( get(user, 'mustChangePassword') && provider === 'local' ) {
get(this,'session').set(C.SESSION.BACK_TO, window.location.origin); get(this,'session').set(C.SESSION.BACK_TO, window.location.origin);
get(this, 'access').set('userCode', code);
get(this, 'router').transitionTo('update-password'); get(this, 'router').transitionTo('update-password');
} else { } else {
setProperties(this, { setProperties(this, {
user: null, user: null,
code: null, code: null,
}); });
get(this, 'access').set('userCode', null);
this.send('complete', true); this.send('complete', true);
} }
}).catch((err) => { }).catch((err) => {

View File

@ -18,6 +18,7 @@ export default Service.extend({
app: service(), app: service(),
me: null, me: null,
userCode: null,
// These are set by authenticated/route // These are set by authenticated/route
// Is access control enabled // Is access control enabled

View File

@ -1,7 +1,7 @@
{{#if showHeader}} {{#if showHeader}}
<div class="header"> <div class="header">
<h1>{{t 'serverUrl.header.label'}}</h1> <h1>{{t 'serverUrl.header.label'}}</h1>
<p class="help-text">{{t 'serverUrl.header.detail'}}</p> <p class="help-text">{{t 'serverUrl.header.detail' appName=settings.appName}}</p>
</div> </div>
{{/if}} {{/if}}
<form class="horizontal-form container-fluid text-left" {{action 'saveServerUrl' on="submit"}}> <form class="horizontal-form container-fluid text-left" {{action 'saveServerUrl' on="submit"}}>

View File

@ -5029,7 +5029,7 @@ serviceLog:
serverUrl: serverUrl:
header: header:
label: Rancher Server URL 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: button:
save: Save URL save: Save URL