Skip to content

Commit

Permalink
feat: 馃幐 Remove required personal number on login on same device (#271)
Browse files Browse the repository at this point in the history
* feat: 馃幐 Remove required personal number on login on same device

When using the same device for BankId, personal number is not required.
You use the autostarttoken to bind it together.

Update embedded api to 4.4.0
  • Loading branch information
whyer committed Apr 17, 2021
1 parent 243e980 commit 2604640
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
15 changes: 10 additions & 5 deletions packages/app/components/login.component.tsx
Expand Up @@ -120,9 +120,14 @@ export const Login = () => {
const startLogin = async (text: string) => {
if (loginMethodIndex < 2) {
showModal(true)
const ssn = Personnummer.parse(text).format(true)
setCachedSsn(ssn)
setSocialSecurityNumber(ssn)

let ssn
if (loginMethodIndex === 1) {
ssn = Personnummer.parse(text).format(true)
setCachedSsn(ssn)
setSocialSecurityNumber(ssn)
}

const status = await api.login(ssn)
setCancelLoginRequest(() => () => status.cancel())
if (status.token !== 'fake' && loginMethodIndex === 0) {
Expand All @@ -144,7 +149,7 @@ export const Login = () => {
<>
<Image source={require('../assets/boys.png')} style={styles.image} />
<View style={styles.loginForm}>
{loginMethodIndex !== 2 && (
{loginMethodIndex === 1 && (
<Input
label={translate('general.socialSecurityNumber')}
autoFocus
Expand All @@ -168,7 +173,7 @@ export const Login = () => {
onPress={() => startLogin(socialSecurityNumber)}
style={styles.loginButton}
appearance="ghost"
disabled={loginMethodIndex !== 2 && !valid}
disabled={loginMethodIndex === 1 && !valid}
status="primary"
accessoryLeft={SecureIcon}
size="medium"
Expand Down
2 changes: 1 addition & 1 deletion packages/app/package.json
Expand Up @@ -24,7 +24,7 @@
"@react-navigation/native": "5.9.4",
"@react-navigation/stack": "5.14.4",
"@skolplattformen/api-hooks": "2.1.0",
"@skolplattformen/embedded-api": "4.3.0",
"@skolplattformen/embedded-api": "4.4.0",
"@ui-kitten/components": "5.0.0",
"@ui-kitten/eva-icons": "5.0.0",
"buffer": "6.0.3",
Expand Down
8 changes: 4 additions & 4 deletions packages/app/yarn.lock
Expand Up @@ -1500,10 +1500,10 @@
resolved "https://registry.yarnpkg.com/@skolplattformen/curriculum/-/curriculum-1.2.0.tgz#f6975bf241c09e05bb81f3493ac7cf35aa23d6c4"
integrity sha512-26/R+ZN1P0jrH26xVrn6ue8WxDPag/TRWqEKyMckSbPWFUpuDRv7/FXRF3q4cRIIowvus6V4L63y3u4ao7Yj3A==

"@skolplattformen/embedded-api@4.3.0":
version "4.3.0"
resolved "https://registry.yarnpkg.com/@skolplattformen/embedded-api/-/embedded-api-4.3.0.tgz#e76b0fe3511e969d8108cff7d809e9f0f0d834da"
integrity sha512-z9qVhW9z67Wcyos1r0oG8hNW0ChUVcrWyBo3y6KjisejFoUeUD4+YMDXhZolzeg+sxxeoTfwwUwmrEywurCZIg==
"@skolplattformen/embedded-api@4.4.0":
version "4.4.0"
resolved "https://registry.yarnpkg.com/@skolplattformen/embedded-api/-/embedded-api-4.4.0.tgz#668a0c05cd7b94edfeee02dfebe859a823b68669"
integrity sha512-oU6mCsMfHE7U42SYMhjlL2tHRkt4vehIiuN2a0gNOUqdkeL3/xhH2EDFds2ae2Jh1NVcczMASQxctggOiFs4zQ==
dependencies:
"@skolplattformen/curriculum" "^1.2.0"
"@types/he" "^1.1.1"
Expand Down

0 comments on commit 2604640

Please sign in to comment.