Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-Turmoil committed Aug 27, 2024
2 parents a60bb8b + 11934a4 commit b5ec837
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import cn.edu.buaa.patpat.boot.common.utils.Requests;
import cn.edu.buaa.patpat.boot.exceptions.ForbiddenException;
import cn.edu.buaa.patpat.boot.exceptions.UnauthorizedException;
import cn.edu.buaa.patpat.boot.modules.auth.api.AuthApi;
import cn.edu.buaa.patpat.boot.modules.auth.models.AuthPayload;
Expand Down Expand Up @@ -60,10 +61,10 @@ private AuthPayload validatePermission(Method method, AuthLevel level) {
throw new UnauthorizedException(M("auth.login.not"));
} else if ((level == AuthLevel.TEACHER) && !auth.isTeacher()) {
log.error("Require teacher permission for method {}", method.getName());
throw new UnauthorizedException(M("auth.permission.denied"));
throw new ForbiddenException(M("auth.permission.denied"));
} else if ((level == AuthLevel.TA) && !auth.isTa()) {
log.error("Require T.A. permission for method {}", method.getName());
throw new UnauthorizedException(M("auth.permission.denied"));
throw new ForbiddenException(M("auth.permission.denied"));
}
return auth;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jwt:
refresh-expiration: 604800 # 7 days
cookies:
domain: ${DOMAIN}
http-only: true
http-only: false
secure: false
bucket:
serve: false
Expand Down
14 changes: 7 additions & 7 deletions src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
account.register.success=Account has been created successfully
account.register.disabled=Account registration is not allowed
account.register.success=Successfully registered
account.register.disabled=Registration is not allowed
account.exists=BUAA ID already exists
account.exists.not=Account not found
account.password.incorrect=Password incorrect
account.login.course.not=You are not in any active course
account.login.success=Welcome to Patpat Online, {0}!
account.logout.success=See you later!
account.create.success=The account has been created successfully
account.update.success=The account has been updated successfully
account.create.success=Your account has been created successfully
account.update.success=Your account has been updated successfully
account.update.forbidden=You are not allowed to update this account
account.update.forbidden.self=You are not allowed to update this account
account.password.update.success=The password has been updated successfully
account.password.reset.success=The password has been reset successfully
account.update.forbidden.self=You are not allowed to update your account
account.password.update.success=Password updated successfully
account.password.reset.success=Password reset
account.role.invalid=Invalid role
auth.login.not=Please log in first
auth.permission.denied=Permission denied
Expand Down

0 comments on commit b5ec837

Please sign in to comment.