Changeset 3858


Ignore:
Timestamp:
17 Jan 2009, 07:29:24 (16 years ago)
Author:
Henrik Bettermann
Message:

implement password notification module (send mail not yet tested)

Location:
WAeUP_SRP/trunk
Files:
4 added
7 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/trunk/CHANGES.txt

    r3824 r3858  
    134134-----------------
    135135- implement configuration object (step 1)
     136
     1371.27 (2009-01-17)
     138-----------------
     139- implement password notification module
  • WAeUP_SRP/trunk/WAeUPTool.py

    r3840 r3858  
    182182                                                        "Manager" in roles)
    183183        info['is_clearanceofficer'] = not is_student and ("ClearanceOfficer" in roles)
    184         is_allowed = info['is_allowed'] = not is_anonymous
     184        #is_allowed = info['is_allowed'] = not is_anonymous
    185185        requested_id = context.getStudentId()
    186186        student_id  = None
    187         if is_allowed:
    188             if not is_student and requested_id:
    189                 student_id  = requested_id
    190             elif not is_allowed and (not is_staff or  member_id != requested_id):
     187        if not is_anonymous and requested_id:
     188            if (is_student and member_id == requested_id) or is_staff:
     189                student_id = requested_id
     190            else:   
    191191                logger.info('%s tried to access %s of %s' % (member_id,context.portal_type,requested_id))
    192             else:
    193                 student_id = member_id
    194192        info['student_id'] = student_id
    195193        return info
     
    570568    ###)
    571569
    572     security.declareProtected(View,'getCredential') ###(
     570    security.declarePublic('getCredential') ###(
    573571    def getCredential(self,student_id):
    574572        student_entry = getattr(self.portal_directories.students,student_id,None)
    575         if not self.isStaff():
    576             mtool = self.portal_membership
    577             member = mtool.getAuthenticatedMember()
    578             logger = logging.getLogger('WAeUPTool.getCredential')
    579             logger.info('%s tried to access password of %s' % (member,student_id))
    580             return None
     573        #import pdb;pdb.set_trace()
     574        #if not self.isStaff():
     575        #    mtool = self.portal_membership
     576        #    member = mtool.getAuthenticatedMember()
     577        #    logger = logging.getLogger('WAeUPTool.getCredential')
     578        #    logger.info('%s tried to access password of %s' % (member,student_id))
     579        #    return None
    581580        if student_entry is None:
    582581            return None
  • WAeUP_SRP/trunk/Widgets.py

    r3847 r3858  
    24742474
    24752475widgetRegistry.register(DiscFileWidget)
     2476
     2477
     2478class RegMatricNoWidget(CPSStringWidget): ###(
     2479    """ RegMatricNo Widget"""
     2480    meta_type = "RegMatricNo Widget"
     2481    def validate(self, datastructure, **kw):
     2482        """Validate datastructure and update datamodel."""
     2483        valid = CPSStringWidget.validate(self, datastructure, **kw)
     2484        widget_id = self.getWidgetId()
     2485        value = datastructure[widget_id].upper()
     2486        err = 0
     2487        #import pdb;pdb.set_trace()
     2488        if not valid:
     2489            err = 'Invalid number'
     2490        else:
     2491            student_record = self.students_catalog(jamb_reg_no = value)
     2492            if len(student_record) < 1:
     2493                student_record = self.students_catalog(matric_no = value)
     2494                if len(student_record) < 1:
     2495                    err = 'No student record with this registration or matric number'
     2496                else:
     2497                    datastructure['record'] = student_record[0]
     2498                    #import pdb;pdb.set_trace()
     2499            else:
     2500                datastructure['record'] = student_record[0]
     2501                #import pdb;pdb.set_trace()
     2502        if err:
     2503            datastructure.setError(widget_id, err)
     2504        else:
     2505            datamodel = datastructure.getDataModel()
     2506            datamodel[self.fields[0]] = value
     2507       
     2508        return not err
     2509
     2510InitializeClass(RegMatricNoWidget)
     2511
     2512widgetRegistry.register(RegMatricNoWidget)
     2513
     2514class CheckEmailWidget(CPSStringWidget): ###(
     2515    """ CheckEmail Widget"""
     2516    meta_type = "CheckEmail Widget"
     2517    def validate(self, datastructure, **kw):
     2518        """Validate datastructure and update datamodel."""
     2519        if datastructure.errors:
     2520            return
     2521        valid = CPSStringWidget.validate(self, datastructure, **kw)
     2522        widget_id = self.getWidgetId()
     2523        value = datastructure[widget_id].upper()
     2524        err = 0
     2525        #import pdb;pdb.set_trace()
     2526        if not valid:
     2527            err = 'Invalid string'
     2528        else:
     2529            email_cat = datastructure['record'].email.upper()
     2530            if email_cat != value:
     2531                err = 'Email address does not match'
     2532            else:
     2533                pass
     2534        if err:
     2535            datastructure.setError(widget_id, err)
     2536        else:
     2537            datamodel = datastructure.getDataModel()
     2538            datamodel[self.fields[0]] = value           
     2539       
     2540        return not err
     2541
     2542InitializeClass(CheckEmailWidget)
     2543
     2544widgetRegistry.register(CheckEmailWidget)
     2545
    24762546###)
    24772547
  • WAeUP_SRP/trunk/profiles/default/layouts.xml

    r3824 r3858  
    117117  <object name="student_gown" meta_type="CPS Layout"/>
    118118  <object name="configuration" meta_type="CPS Layout"/>
     119  <object name="retrieve_password" meta_type="CPS Layout"/>
    119120 
    120121</object>
  • WAeUP_SRP/trunk/profiles/default/schemas.xml

    r3824 r3858  
    8989 <object name="waeup_common" meta_type="CPS Schema"/>
    9090 <object name="configuration" meta_type="CPS Schema"/>
     91 <object name="retrieve_password" meta_type="CPS Schema"/>
    9192 
    9293 
  • WAeUP_SRP/trunk/skins/waeup_student/getMemberInfo.py

    r3458 r3858  
    3737student_id = info['student_id']
    3838if student_id is None:
    39     return None
     39    return 'You are not allowed to access this information!'
    4040
    4141students_object = context.portal_url.getPortalObject().campus.students
  • WAeUP_SRP/trunk/skins/waeup_student/login_student.pt

    r2606 r3858  
    5858
    5959  </form>
     60 
     61  <br />
     62 
     63  <a href=/retrieve_password>Forgot your Id or Password?</a>
    6064
    61   <br />
     65  <br /><br />
    6266
    6367  <p i18n:translate="help_login_aware_logout">
Note: See TracChangeset for help on using the changeset viewer.