Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tutao/tutanota
Browse files Browse the repository at this point in the history
  • Loading branch information
charlag committed Nov 15, 2018
2 parents f3d58ba + 1f526a4 commit 9e147bc
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 15 deletions.
14 changes: 8 additions & 6 deletions src/gui/base/TextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class TextField {

isEmpty: Function;

constructor(labelIdOrLabelTextFunction: string | lazy<string>, helpLabel: ?lazy<string>) {
constructor(labelIdOrLabelTextFunction: string | lazy<string>, helpLabel: ?lazy<string> | ?lazy<Vnode<any>>) {
this.label = labelIdOrLabelTextFunction
this.active = false
this.webkitAutofill = false
Expand Down Expand Up @@ -109,11 +109,13 @@ export class TextField {
])
]),
]),
this.helpLabel ? m("div.small.noselect.click", {
onclick: () => {
if (this._domInput) this._domInput.focus()
}
}, this.helpLabel()) : []
this.helpLabel
? m("div.small.noselect.click", {
onclick: () => {
if (this._domInput) this._domInput.focus()
}
}, this.helpLabel())
: []
])
}

Expand Down
10 changes: 9 additions & 1 deletion src/login/LoginViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,17 @@ export class LoginViewController implements ILoginViewController {
if (auth && !auth.recoverCode && logins.isGlobalAdminUserLoggedIn() && logins.isInternalUserLoggedIn()) {
NotificationOverlay.show({
view: () => {
return m("", [m("b", lang.get("newFeature_msg")), m("", lang.get("recoveryCodeReminder_msg"))])
return m("", [
m("b", lang.get("newFeature_msg")),
m("", lang.get("recoveryCodeReminder_msg")),
])
}
}, [
{
label: "moreInformation_action",
click: () => window.open(lang.getInfoLink('recoverCode_link'), '_blank'),
type: ButtonType.Secondary
},
{
label: "setUp_action",
click: () => {
Expand Down
18 changes: 18 additions & 0 deletions src/misc/LanguageViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ export const languages: Language[] = [
{code: 'zh_tw', textId: 'languageChineseSimplified_label'}
]

const infoLinks = {
"recoverCode_link": {
"de": "https://tutanota.uservoice.com/knowledgebase/articles/470716",
"en": "https://tutanota.uservoice.com/knowledgebase/articles/470717"
},
"2FA_link": {
"de": "https://tutanota.uservoice.com/knowledgebase/articles/1201945",
"en": "https://tutanota.uservoice.com/knowledgebase/articles/1201942"
}
}

/**
* Provides all localizations of strings on our gui.
*
Expand Down Expand Up @@ -238,6 +249,13 @@ class LanguageViewModel {
}
}

getInfoLink(id: string) {
const code = ["de", "de_sie"].includes(this.code)
? "de"
: "en"
return infoLinks[id][code]
}

}

export const lang: LanguageViewModel = new LanguageViewModel()
9 changes: 2 additions & 7 deletions src/settings/EditSecondFactorsForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,17 @@ export class EditSecondFactorsForm {
ColumnWidth.Largest, ColumnWidth.Largest
], true, add2FAButton)
this.view = () => {
const lnk = lang.getInfoLink('2FA_link')
return [
m(".h4.mt-l", lang.get('secondFactorAuthentication_label')),
m(this._2FATable),
m("span.small", lang.get("moreInfo_msg") + " "),
m("span.small.text-break", [m(`a[href=${this._get2FAInfoLink()}][target=_blank]`, this._get2FAInfoLink())]),
m("span.small.text-break", [m(`a[href=${lnk}][target=_blank]`, lnk)]),
]
}
this._updateSecondFactors()
}

_get2FAInfoLink(): string {
return (lang.code === "de" || lang.code === "de_sie")
? "https://tutanota.uservoice.com/knowledgebase/articles/1201945"
: "https://tutanota.uservoice.com/knowledgebase/articles/1201942"
}

_updateSecondFactors(): void {
this._user.getAsync().then(user => {
loadAll(SecondFactorTypeRef, neverNull(user.auth).secondFactors).then(factors => {
Expand Down
12 changes: 11 additions & 1 deletion src/settings/LoginSettingsViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ export class LoginSettingsViewer implements UpdatableSettingsViewer {
let changePasswordButton = new Button("changePassword_label", () => PasswordForm.showChangeOwnPasswordDialog(), () => Icons.Edit)
password._injectionsRight = () => [m(changePasswordButton)]

let recoveryCodeField = new TextField("recoveryCode_label").setValue("***").setDisabled()
let recoveryCodeField = new TextField(
"recoveryCode_label",
() => {
const lnk = lang.getInfoLink("recoverCode_link")
return [
m("span", lang.get("moreInfo_msg") + " "),
m("span.text-break", [m(`a[href=${lnk}][target=_blank]`, lnk)])
]
})
.setValue("***")
.setDisabled()

const showRecoveryCodeAttrs = {
label: "show_action",
Expand Down

0 comments on commit 9e147bc

Please sign in to comment.