package at.ac.tuwien.inso.entity;

import javax.persistence.*;
import java.util.*;

@Entity
public class Lecturer extends UisUser {

    @ManyToMany(mappedBy = "lecturers")
    private List<Subject> subjects = new ArrayList<>();

    protected Lecturer() {

    }

    public Lecturer(String identificationNumber, String name, String email) {
        this(identificationNumber, name, email, null);
    }

    public Lecturer(String identificationNumber, String name, String email, UserAccount account) {
        super(identificationNumber, name, email, account);
    }

    @Override
    protected void adjustRole(UserAccount account) {
        account.setRole(Role.LECTURER);
    }

    public List<Subject> getSubjects() {
        return subjects;
    }
}

@@ -28,16 +28,68 @@
 ntity;%0A%0A
+import org.jboss.aerogear.security.otp.api.Base32;%0A%0A
 import j
@@ -108,16 +108,16 @@
 ence.*;%0A
-
 import j
@@ -275,16 +275,53 @@
 t%3C%3E();%0A%0A
+    private String twoFactorSecret;%0A%0A
     prot
@@ -645,16 +645,64 @@
 count);%0A
+        this.twoFactorSecret = Base32.random();%0A
     %7D%0A%0A 
@@ -851,24 +851,24 @@
 ubjects() %7B%0A
-
         retu
@@ -885,11 +885,207 @@
 s;%0A    %7D
+%0A%0A    public String getTwoFactorSecret() %7B%0A        return twoFactorSecret;%0A    %7D%0A%0A    public void setTwoFactorSecret(String twoFactorSecret) %7B%0A        this.twoFactorSecret = twoFactorSecret;%0A    %7D
 %0A%7D%0A

Refactor Lecturer to contain secret used for two factor authentification