Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Fix invalid message when unauthorized user request to join as member …
Browse files Browse the repository at this point in the history
…of a private project.

Reason:
Basically, unauthorized user are denied access to private project.
But, if unauthorized user access to private project page for any reason,
and request to join as member of this project, then this user get to see the 'Server Error' flash message.

Solution:
* When unauthorized user request to join as member of a private project,
  the flash message is changed correct forbidden message.
  • Loading branch information
김창근 committed Oct 14, 2014
1 parent b8c0bf9 commit 853b292
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
4 changes: 4 additions & 0 deletions conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,10 @@ user.deleted = Deleted user account
user.email = Email address
user.email.duplicate = Email address already exists
user.email.new = New E-mail address
user.enroll.failed = Failed to Sign-up. Server error may have occurred or the request may be invalid.
user.enroll.failed.client = Failed to Sign-up. The request is invalid.\nPlease ask site admin.
user.enroll.failed.network = Failed to Sign-up because network trouble.\nPlease ask site admin.
user.enroll.failed.server = Failed to Sign-up because server error has occurred.\nPlease ask site admin.
user.isAlreadySignupUser = Already signed up?
user.isLocked = Is the user account locked out?
user.locked = This user account is locked
Expand Down
4 changes: 4 additions & 0 deletions conf/messages.ko
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,10 @@ user.deleted = 삭제된 사용자 계정입니다.
user.email = 이메일
user.email.duplicate = 이미 존재하는 이메일입니다.
user.email.new = 새 이메일 주소
user.enroll.failed = 멤버 등록 요청에 실패하였습니다. 서버에 문제가 있거나 올바른 요청이 아닐 수 있습니다.
user.enroll.failed.client = 멤버 등록 요청에 실패하였습니다. 올바른 요청이 아닙니다.\n관리자에게 문의해주세요.
user.enroll.failed.network = 네트워크 문제로 인해 멤버 등록 요청에 실패하였습니다.\n관리자에게 문의해주세요.
user.enroll.failed.server = 서버의 문제로 인해 멤버 등록 요청에 실패하였습니다.\n관리자에게 문의해주세요.
user.isAlreadySignupUser = 이미 가입하셨나요?
user.isLocked = 잠김여부
user.locked = 잠긴 사용자 계정입니다.
Expand Down
25 changes: 23 additions & 2 deletions public/javascripts/service/yobi.project.Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
var htVar = {};
var htElement = {};

var clientErrorStatus = /^4[0-9][0-9]$/
var serverErrorStatus = /^5[0-9][0-9]$/
var networkErrorStatus = 0;

/**
* initialize
*/
Expand Down Expand Up @@ -99,8 +103,25 @@
"success": function(){
document.location.reload();
},
"error": function(){
$yobi.notify("Server Error");
"error": function(oXHR){
if(oXHR.readyState == networkErrorStatus){
$yobi.notify(Messages("user.enroll.failed.network"), 3000);
}else{
switch(true){
case oXHR.status == 403:
$yobi.notify(Messages("error.forbidden"), 3000);
break;
case clientErrorStatus.test(oXHR.status):
$yobi.notify(Messages("user.enroll.failed.client"), 3000);
break;
case serverErrorStatus.test(oXHR.status):
$yobi.notify(Messages("user.enroll.failed.server"), 3000);
break;
default:
$yobi.notify(Messages("user.enroll.failed"), 3000);
break;
}
}
}
})

Expand Down

0 comments on commit 853b292

Please sign in to comment.