예제 #1
0
    def resend_create(self, workspace_id):
        #verify email valid and send invitation mail
        if 'email' in request.params:
            if request.params['email'] == '':
                return render('invitation/resend_show.mako')
            user = User.get_by_lower_email(int(workspace_id), request.params['email'])
            if (user):
                # Instantiate a Kcd client.
                invitees = []
                invitee = WorkspaceInvitee()
                invitee.email_address = user.email
                invitee.send_mail = True
                
                invitees.append(invitee)
                message = "click on the link to join the teambox"
                
                kc = KcdClient(get_cached_kcd_external_conf_object())
                #TODO handle kcd errors, render confirmation messages
                kc.invite_users(workspace_id, message, invitees)
                ui_info(message="You have been re-invited to the Teambox, please check you email and follow instructions.")
                return render('invitation/resend_success.mako')

            else:
                #please contact ws owner
                ui_error(message="No invitation to this teambox had been sent to this email address." + \
                              " If you were not invited to this teambox, please contact the teambox owner.")
                return render('invitation/resend_show.mako')
                pass
        else:
            abort(403)
예제 #2
0
    def show(self, workspace_id, email_id):
           
        ws = c.workspace
        
        if not ws: 
            log.warn("InvitationController().show(): Workspace %s does not exist." % ( workspace_id ) )
            abort(403)
        
        invitation = Invitation.get_by(email_id = email_id)
       
        if not invitation: 
            log.warn("InvitationController().show(): No invitation '%s' for workspace %s" \
                % ( email_id, workspace_id ) )
            ui_error(code="invitation_link_not_valid")
            return render('message/show.mako')
            #abort(403)

        if 'user_id' in session:
            if session['user_id'] == invitation.user_id:
                # User is already logged - redirect.
                redirect_to(url('teambox', workspace_id = session['workspace_id']))
            else:
                # User is logged as another user - unlog.
                init_session(c.workspace, reinit=True)
 
        if (ws.id==invitation.kws_id):
            ### Temp workaround to show notification management page for users with no passwords. ###
            session['tmp_notif_user_id'] = invitation.user_id
            session.save()
            c.notif_flag = True
            ### End workaround ###

            if ws.secured:
                c.email_id = email_id
                
                kcd_user = KcdUser.get_by(user_id = invitation.user_id, kws_id = invitation.kws_id)
                if not kcd_user:
                    log.warn("kcd user " + str(invitation.user_id) + " for workspace " + str(workspace_id) + " not found in database")
                    abort(403)

                if kcd_user.pwd: #prompt for password and for credentials download
                    c.show_pass = True
                    pass
                else: #prompt for credintials download
                    c.show_pass = False
                    pass
                return render('/invitation/show.mako')
            else: #authorize
                self._login(invitation)
        else:
            abort(403)
예제 #3
0
    def get(self, workspace_id, email_id):
        # Return a rendered template
        #return render('/credentials_file.mako')
        # or, return a response
        response.content_type = "application/wsl"

        filename = "kwmo_creds.wsl"
        # Temporarily disabled - need to be debugged.
        if request.params.has_key('interactive') and str(request.params.get('interactive')) == "1":
            filename = c.workspace.name + ".wsl"

        response.headers['Content-disposition'] = 'attachment; filename="%s"' % ( filename.encode('latin1') )
        
        #fix for IE
        response.headers['Pragma'] = 'public'
        response.headers['Cache-Control'] = 'max-age-0'

        errorStr = None
        #ws = Workspace.get_by(id= workspace_id)
        ws = c.workspace
        invitation = Invitation.get_by(email_id = email_id)
        
        if (ws and invitation):
            user = User.get_by(id = invitation.user_id, workspace=ws)
            if(user and ws.id==invitation.kws_id):
                c.invitation = invitation
                c.user = user
                c.workspace = ws
                conf = get_cached_kcd_external_conf_object()
                c.kcd_host = conf.kcd_host
                c.kcd_port = conf.kcd_port
                if ('password' in request.params):
                    c.password = request.params['password']
                    
                if ('user_id' in session):
                    c.password = session['password']
            else:
                errorStr = "User was not invited to this workspace"

        else:
            errorStr = "Invalid email_id or workspace_id"
        
        if errorStr:
            c.errorStr = errorStr
            return render('credentials_file/error.mako')
        else:
            return render('credentials_file/get.mako')
예제 #4
0
파일: old_wleu.py 프로젝트: fdgonthier/kas
 def authorize_show(self, workspace_id):
     #prompt for password
     if 'user_id' in session:
         redirect_to(url('teambox', workspace_id = session['workspace_id']))
     
     if c.workspace.compat_v2:
         return render('/old_wleu/authorize_show.mako')
     else:
         abort(404)
예제 #5
0
    def show(self, workspace_id):
        #TODO: handle logged out users
        if 'tmp_notif_user_id' in session:
            user_id = session['tmp_notif_user_id']
        elif 'user_id' in session:
            user_id = session['user_id']
        else:
            abort(403)

        settings = UserWorkspaceSettings(user_id, workspace_id)

        c.notificationEnabled = settings.getNotificationsEnabled()
        c.summaryEnabled = settings.getSummaryEnabled()
        if (c.workspace.public):
            c.email_id = session['email_id']

        if 'HTTP_REFERER' in request.environ:
            session['notif_page_referer'] = request.environ['HTTP_REFERER']
            session.save()

        if 'notif_page_referer' in session:
            c.cancel_url = session['notif_page_referer']

        return render('/teambox/settings.mako')
예제 #6
0
    def show(self, workspace_id):
        # TODO: handle logged out users
        if "tmp_notif_user_id" in session:
            user_id = session["tmp_notif_user_id"]
        elif "user_id" in session:
            user_id = session["user_id"]
        else:
            abort(403)

        settings = UserWorkspaceSettings(user_id, workspace_id)

        c.notificationEnabled = settings.getNotificationsEnabled()
        c.summaryEnabled = settings.getSummaryEnabled()
        if c.workspace.public:
            c.email_id = session["email_id"]

        if "HTTP_REFERER" in request.environ:
            session["notif_page_referer"] = request.environ["HTTP_REFERER"]
            session.save()

        if "notif_page_referer" in session:
            c.cancel_url = session["notif_page_referer"]

        return render("/teambox/settings.mako")
예제 #7
0
 def resend_show(self):
     return render('invitation/resend_show.mako')
예제 #8
0
파일: message.py 프로젝트: fdgonthier/kas
 def show(self):
     return render('message/show.mako')
예제 #9
0
파일: message.py 프로젝트: fdgonthier/kas
 def showold(self, code):
     ui_warn(code=code)
     return render('message/show.mako')
예제 #10
0
파일: old_wleu.py 프로젝트: fdgonthier/kas
 def show_members(self, workspace_id):
     if 'same_pwd_members' in session:
         c.same_pwd_members = session['same_pwd_members']
         return render('/old_wleu/show_members.mako')
     else:
         abort(403)
예제 #11
0
파일: license.py 프로젝트: fdgonthier/kas
 def show(self):
     c.add_headers = '<link href="css/kwmo/kwmo.css" rel="Stylesheet" type="text/css" />'
     return render('/teambox/license.mako')
예제 #12
0
 def show(self):
     return render('message/show.mako')
예제 #13
0
 def showold(self, code):
     ui_warn(code=code)
     return render('message/show.mako')