diff --git a/cypress/integration/users-login.spec.js b/cypress/integration/users-login.spec.js index 412d188fa..20decf064 100644 --- a/cypress/integration/users-login.spec.js +++ b/cypress/integration/users-login.spec.js @@ -34,7 +34,9 @@ describe("Users Login", () => { cy.get("#usernameInput-ldap").type(username).should("have.value", username); - cy.get("#passwordInput-ldap").type("invalid").should("have.value", "invalid"); + cy.get("#passwordInput-ldap") + .type("invalid") + .should("have.value", "invalid"); cy.get("button[type=submit]").click(); @@ -44,7 +46,7 @@ describe("Users Login", () => { cy.contains( "Unable to connect to the authentication service. Please try again later or contact website maintainer." ); - } + } }); cy.get('mat-tab-group [role="tab"]').contains("Local").click(); @@ -53,7 +55,7 @@ describe("Users Login", () => { cy.get("#passwordInput").type("invalid").should("have.value", "invalid"); - cy.get('.mat-snack-bar-container').should('not.exist'); + cy.get(".mat-snack-bar-container").should("not.exist"); cy.get("button[type=submit]").click(); @@ -101,7 +103,7 @@ describe("Users Login", () => { cy.url().should("include", "/login"); }); - it("logs in with admin account should be able to see all the content properly from user information", ()=>{ + it("logs in with admin account should be able to see all the content properly from user information", () => { cy.visit("/login"); cy.get('mat-tab-group [role="tab"]').contains("Local").click(); @@ -109,65 +111,75 @@ describe("Users Login", () => { cy.get("#usernameInput").type(username).should("have.value", username); cy.get("#passwordInput").type(password).should("have.value", password); - + cy.get("button[type=submit]").click(); cy.get(".user-button").should("contain.text", username).click(); cy.get("[data-cy=setting-button]").click(); - + cy.get("[data-cy=user-name]").should("contain.text", username); - cy.get("[data-cy=user-email]").invoke('text').should("not.be.empty"); + cy.get("[data-cy=user-email]").invoke("text").should("not.be.empty"); - cy.get("[data-cy=user-id]").invoke('text').should("not.be.empty"); + cy.get("[data-cy=user-id]").invoke("text").should("not.be.empty"); - cy.get("[data-cy=user-accessGroup]").invoke('text').should("not.be.empty"); + cy.get("[data-cy=user-accessGroup]").invoke("text").should("not.be.empty"); cy.get(".copy-button").click(); - cy.get("[data-cy=user-token]").invoke('text').then((token) => { - cy.window().then((win) => { - win.navigator.clipboard.readText().then((clipboardText) => { - expect(clipboardText).to.equal(token); + cy.get("[data-cy=user-token]") + .invoke("text") + .then((token) => { + cy.window().then((win) => { + win.navigator.clipboard.readText().then((clipboardText) => { + expect(clipboardText).to.equal(token); + }); }); }); - }); - - }) - it("logs in with normal user account should be able to see all the content properly from user information", ()=>{ + cy.get("[data-cy=auth-strategy]").contains("local"); + }); + + it("logs in with normal user account should be able to see all the content properly from user information", () => { cy.visit("/login"); cy.get('mat-tab-group [role="tab"]').contains("Local").click(); - cy.get("#usernameInput").type(guestUsername).should("have.value", guestUsername); + cy.get("#usernameInput") + .type(guestUsername) + .should("have.value", guestUsername); + + cy.get("#passwordInput") + .type(guestPassword) + .should("have.value", guestPassword); - cy.get("#passwordInput").type(guestPassword).should("have.value", guestPassword); - cy.get("button[type=submit]").click(); cy.get(".user-button").should("contain.text", guestUsername).click(); cy.get("[data-cy=setting-button]").click(); - + cy.get("[data-cy=user-name]").should("contain.text", guestUsername); - cy.get("[data-cy=user-email]").invoke('text').should("not.be.empty"); + cy.get("[data-cy=user-email]").invoke("text").should("not.be.empty"); - cy.get("[data-cy=user-id]").invoke('text').should("not.be.empty"); + cy.get("[data-cy=user-id]").invoke("text").should("not.be.empty"); - cy.get("[data-cy=user-accessGroup]").invoke('text').should("not.be.empty"); + cy.get("[data-cy=user-accessGroup]").invoke("text").should("not.be.empty"); cy.get(".copy-button").click(); - cy.get("[data-cy=user-token]").invoke('text').then((token) => { - cy.window().then((win) => { - win.navigator.clipboard.readText().then((clipboardText) => { - expect(clipboardText).to.equal(token); + cy.get("[data-cy=user-token]") + .invoke("text") + .then((token) => { + cy.window().then((win) => { + win.navigator.clipboard.readText().then((clipboardText) => { + expect(clipboardText).to.equal(token); + }); }); }); - }); - }) + cy.get("[data-cy=auth-strategy]").contains("local"); + }); }); diff --git a/src/app/shared/sdk/models/User.ts b/src/app/shared/sdk/models/User.ts index 378b9ed0e..8ede85de9 100644 --- a/src/app/shared/sdk/models/User.ts +++ b/src/app/shared/sdk/models/User.ts @@ -1,127 +1,128 @@ -/* eslint-disable */ -import { - UserSetting, - UserIdentity, - UserCredential -} from '../index'; - -declare var Object: any; -export interface UserInterface { - "realm"?: string; - "username"?: string; - "email": string; - "emailVerified"?: boolean; - "id"?: any; - "password"?: string; - accessTokens?: any[]; - settings?: UserSetting; - identities?: UserIdentity[]; - credentials?: UserCredential[]; -} - -export class User implements UserInterface { - "realm": string; - "username": string; - "email": string; - "emailVerified": boolean; - "id": any; - "password": string; - accessTokens: any[]; - settings: UserSetting; - identities: UserIdentity[]; - credentials: UserCredential[]; - constructor(data?: UserInterface) { - Object.assign(this, data); - } - /** - * The name of the model represented by this $resource, - * i.e. `User`. - */ - public static getModelName() { - return "User"; - } - /** - * @method factory - * @author Jonathan Casarrubias - * @license MIT - * This method creates an instance of User for dynamic purposes. - **/ - public static factory(data: UserInterface): User{ - return new User(data); - } - /** - * @method getModelDefinition - * @author Julien Ledun - * @license MIT - * This method returns an object that represents some of the model - * definitions. - **/ - public static getModelDefinition() { - return { - name: 'User', - plural: 'Users', - path: 'Users', - idName: 'id', - properties: { - "realm": { - name: 'realm', - type: 'string' - }, - "username": { - name: 'username', - type: 'string' - }, - "email": { - name: 'email', - type: 'string' - }, - "emailVerified": { - name: 'emailVerified', - type: 'boolean' - }, - "id": { - name: 'id', - type: 'any' - }, - "password": { - name: 'password', - type: 'string' - }, - }, - relations: { - accessTokens: { - name: 'accessTokens', - type: 'any[]', - model: '', - relationType: 'hasMany', - keyFrom: 'id', - keyTo: 'userId' - }, - settings: { - name: 'settings', - type: 'UserSetting', - model: 'UserSetting', - relationType: 'hasOne', - keyFrom: 'id', - keyTo: 'userId' - }, - identities: { - name: 'identities', - type: 'UserIdentity[]', - model: 'UserIdentity', - relationType: 'hasMany', - keyFrom: 'id', - keyTo: 'userId' - }, - credentials: { - name: 'credentials', - type: 'UserCredential[]', - model: 'UserCredential', - relationType: 'hasMany', - keyFrom: 'id', - keyTo: 'userId' - }, - } - } - } -} +/* eslint-disable */ +import { + UserSetting, + UserIdentity, + UserCredential +} from '../index'; + +declare var Object: any; +export interface UserInterface { + "realm"?: string; + "username"?: string; + "email": string; + "emailVerified"?: boolean; + "id"?: any; + "password"?: string; + accessTokens?: any[]; + settings?: UserSetting; + identities?: UserIdentity[]; + credentials?: UserCredential[]; +} + +export class User implements UserInterface { + "realm": string; + "username": string; + "email": string; + "emailVerified": boolean; + "id": any; + "password": string; + "authStrategy"?: string; + accessTokens: any[]; + settings: UserSetting; + identities: UserIdentity[]; + credentials: UserCredential[]; + constructor(data?: UserInterface) { + Object.assign(this, data); + } + /** + * The name of the model represented by this $resource, + * i.e. `User`. + */ + public static getModelName() { + return "User"; + } + /** + * @method factory + * @author Jonathan Casarrubias + * @license MIT + * This method creates an instance of User for dynamic purposes. + **/ + public static factory(data: UserInterface): User{ + return new User(data); + } + /** + * @method getModelDefinition + * @author Julien Ledun + * @license MIT + * This method returns an object that represents some of the model + * definitions. + **/ + public static getModelDefinition() { + return { + name: 'User', + plural: 'Users', + path: 'Users', + idName: 'id', + properties: { + "realm": { + name: 'realm', + type: 'string' + }, + "username": { + name: 'username', + type: 'string' + }, + "email": { + name: 'email', + type: 'string' + }, + "emailVerified": { + name: 'emailVerified', + type: 'boolean' + }, + "id": { + name: 'id', + type: 'any' + }, + "password": { + name: 'password', + type: 'string' + }, + }, + relations: { + accessTokens: { + name: 'accessTokens', + type: 'any[]', + model: '', + relationType: 'hasMany', + keyFrom: 'id', + keyTo: 'userId' + }, + settings: { + name: 'settings', + type: 'UserSetting', + model: 'UserSetting', + relationType: 'hasOne', + keyFrom: 'id', + keyTo: 'userId' + }, + identities: { + name: 'identities', + type: 'UserIdentity[]', + model: 'UserIdentity', + relationType: 'hasMany', + keyFrom: 'id', + keyTo: 'userId' + }, + credentials: { + name: 'credentials', + type: 'UserCredential[]', + model: 'UserCredential', + relationType: 'hasMany', + keyFrom: 'id', + keyTo: 'userId' + }, + } + } + } +} diff --git a/src/app/users/user-settings/user-settings.component.html b/src/app/users/user-settings/user-settings.component.html index ceefab8bc..98e302e9a 100644 --- a/src/app/users/user-settings/user-settings.component.html +++ b/src/app/users/user-settings/user-settings.component.html @@ -45,7 +45,10 @@ Id {{ vm.user.id }} - + Groups {{ vm.profile.accessGroups }} @@ -58,6 +61,10 @@ + + Auth strategy + {{ vm.user.authStrategy }} +