예제 #1
0
파일: views.py 프로젝트: hilerchyn/seahub
def set_repo_password(request, repo, password):
    assert password, 'password must not be none'

    try:
        seafserv_threaded_rpc.set_passwd(repo.id, request.user.username, password)
    except SearpcError, e:
        if e.msg == 'Bad arguments':
            return api_error(request, '400')
        elif e.msg == 'Repo is not encrypted':
            return api_error(request, '406')
        elif e.msg == 'Incorrect password':
            return api_error(request, '402')
        elif e.msg == 'Internal server error':
            return api_error(request, '500')
        else:
            return api_error(request, '417', "SearpcError:" + e.msg)
예제 #2
0
def set_repo_password(request, repo, password):
    assert password, 'password must not be none'

    try:
        seafserv_threaded_rpc.set_passwd(repo.id, request.user.username, password)
    except SearpcError, e:
        if e.msg == 'Bad arguments':
            return api_error(status.HTTP_400_BAD_REQUEST, e.msg)
        elif e.msg == 'Repo is not encrypted':
            return api_error(status.HTTP_409_CONFLICT, e.msg)
        elif e.msg == 'Incorrect password':
            return api_error(status.HTTP_400_BAD_REQUEST, e.msg)
        elif e.msg == 'Internal server error':
            return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, e.msg)
        else:
            return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, e.msg)
예제 #3
0
def set_repo_password(request, repo, password):
    assert password, 'password must not be none'

    try:
        seafserv_threaded_rpc.set_passwd(repo.id, request.user.username, password)
    except SearpcError, e:
        if e.msg == 'Bad arguments':
            return api_error(status.HTTP_400_BAD_REQUEST, e.msg)
        elif e.msg == 'Repo is not encrypted':
            return api_error(status.HTTP_409_CONFLICT, e.msg)
        elif e.msg == 'Incorrect password':
            return api_error(status.HTTP_400_BAD_REQUEST, e.msg)
        elif e.msg == 'Internal server error':
            return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, e.msg)
        else:
            return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, e.msg)
예제 #4
0
파일: forms.py 프로젝트: peckjerry/seahub
 def clean(self):
     if 'password' in self.cleaned_data:
         repo_id = self.cleaned_data['repo_id']
         username = self.cleaned_data['username']
         password = self.cleaned_data['password']
         try:
             seafserv_threaded_rpc.set_passwd(repo_id, username, password)
         except SearpcError, e:
             if e.msg == 'Bad arguments':
                 raise forms.ValidationError(_(u'Bad url format'))
             elif e.msg == 'Incorrect password':
                 raise forms.ValidationError(_(u'Wrong password'))
             elif e.msg == 'Internal server error':
                 raise forms.ValidationError(_(u'Internal server error'))
             else:
                 raise forms.ValidationError(_(u'Decrypt library error'))
예제 #5
0
파일: forms.py 프로젝트: rutsky/seahub
 def clean(self):
     if 'password' in self.cleaned_data:
         repo_id = self.cleaned_data['repo_id']
         username = self.cleaned_data['username']
         password = self.cleaned_data['password']
         try:
             seafserv_threaded_rpc.set_passwd(repo_id, username, password)
         except SearpcError, e:
             if e.msg == 'Bad arguments':
                 raise forms.ValidationError(_(u'Bad url format'))
             # elif e.msg == 'Repo is not encrypted':
             #     return HttpResponseRedirect(reverse('repo',
             #                                         args=[self.repo_id]))
             elif e.msg == 'Incorrect password':
                 raise forms.ValidationError(_(u'Wrong password'))
             elif e.msg == 'Internal server error':
                 raise forms.ValidationError(_(u'Internal server error'))
             else:
                 raise forms.ValidationError(_(u'Decrypt library error'))
예제 #6
0
파일: forms.py 프로젝트: yizhilong28/seahub
 def clean(self):
     if 'password' in self.cleaned_data:
         repo_id = self.cleaned_data['repo_id']
         username = self.cleaned_data['username']
         password = self.cleaned_data['password']
         try:
             seafserv_threaded_rpc.set_passwd(repo_id, username, password)
         except SearpcError, e:
             if e.msg == 'Bad arguments':
                 raise forms.ValidationError(_(u'Bad url format'))
             # elif e.msg == 'Repo is not encrypted':
             #     return HttpResponseRedirect(reverse('repo',
             #                                         args=[self.repo_id]))
             elif e.msg == 'Incorrect password':
                 raise forms.ValidationError(_(u'Wrong password'))
             elif e.msg == 'Internal server error':
                 raise forms.ValidationError(_(u'Internal server error'))
             else:
                 raise forms.ValidationError(_(u'Decrypt library error'))