Compare commits

..

No commits in common. "ff96ba23d70186bd19206bb704cdc3c8a2962e2c" and "00215a81a7b34504eab21a6e1bd869cd8a781871" have entirely different histories.

9 changed files with 13 additions and 11 deletions

View File

@ -26,7 +26,7 @@ export class AuthController {
try {
auth = await createAuth.toAuth();
} catch (error) {
throw error;
return error;
}
return auth
}

View File

@ -54,7 +54,7 @@ export class RunnerController {
try {
runner = await createRunner.toRunner();
} catch (error) {
throw error;
return error;
}
runner = await this.runnerRepository.save(runner)

View File

@ -54,7 +54,7 @@ export class RunnerOrganisationController {
try {
runnerOrganisation = await createRunnerOrganisation.toRunnerOrganisation();
} catch (error) {
throw error;
return error;
}
runnerOrganisation = await this.runnerOrganisationRepository.save(runnerOrganisation);

View File

@ -53,7 +53,7 @@ export class RunnerTeamController {
try {
runnerTeam = await createRunnerTeam.toRunnerTeam();
} catch (error) {
throw error;
return error;
}
runnerTeam = await this.runnerTeamRepository.save(runnerTeam);

View File

@ -44,7 +44,7 @@ export class UserController {
try {
user = await createUser.toUser();
} catch (error) {
throw error;
return error;
}
return this.userRepository.save(user);

View File

@ -43,7 +43,7 @@ export class UserGroupController {
try {
userGroup = await createUserGroup.toUserGroup();
} catch (error) {
throw error;
return error;
}
return this.userGroupsRepository.save(userGroup);

View File

@ -28,14 +28,13 @@ export class CreateAuth {
if (!this.password) {
throw new PasswordNeededError()
}
const found_users = await getConnectionManager().get().getRepository(User).find({ relations: ['groups', 'permissions'], where: [{ username: this.username }, { email: this.email }] });
const found_users = await getConnectionManager().get().getRepository(User).find({ where: [{ username: this.username }, { email: this.email }] });
if (found_users.length === 0) {
throw new UserNotFoundError()
} else {
const found_user = found_users[0]
if (await argon2.verify(found_user.password, this.password + found_user.uuid)) {
const timestamp_accesstoken_expiry = Math.floor(Date.now() / 1000) + 5 * 60
found_user.permissions = found_user.permissions || []
delete found_user.password;
newAuth.access_token = jsonwebtoken.sign({
userdetails: found_user,

View File

@ -35,7 +35,11 @@ export class CreateRunnerTeam extends CreateRunnerGroup {
let newRunnerTeam: RunnerTeam = new RunnerTeam();
newRunnerTeam.name = this.name;
newRunnerTeam.parentGroup = await this.getParent();
try {
newRunnerTeam.parentGroup = await this.getParent();
} catch (error) {
throw error;
}
newRunnerTeam.contact = await this.getContact()

View File

@ -21,14 +21,13 @@ export class RefreshAuth {
} catch (error) {
throw new IllegalJWTError()
}
const found_user = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["userid"] }, { relations: ['groups', 'permissions'] });
const found_user = await getConnectionManager().get().getRepository(User).findOne({ id: decoded["userid"] });
if (!found_user) {
throw new UserNotFoundError()
}
if (found_user.refreshTokenCount !== decoded["refreshtokencount"]) {
throw new RefreshTokenCountInvalidError()
}
found_user.permissions = found_user.permissions || []
delete found_user.password;
const timestamp_accesstoken_expiry = Math.floor(Date.now() / 1000) + 5 * 60
delete found_user.password;