~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/apps/userservice/__init__.py

  • Committer: chadnickbok
  • Date: 2009-01-13 05:33:58 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:1108
Updated the settings page to require the old password
when updating the password. Note that this field
is not shown when using ldap authentication

Show diffs side-by-side

added added

removed removed

Lines of Context:
152
152
 
153
153
from conf import (usrmgt_host, usrmgt_port, usrmgt_magic)
154
154
 
 
155
from auth import authenticate
 
156
from auth.autherror import AuthError
 
157
import urllib
 
158
 
155
159
# The user must send this declaration message to ensure they acknowledge the
156
160
# TOS
157
161
USER_DECLARATION = "I accept the IVLE Terms of Service"
363
367
 
364
368
    # Make a dict of fields to update
365
369
    update = {}
 
370
    oldpassword = fields.getfirst('oldpass')
 
371
    
366
372
    for f in fieldlist:
367
373
        val = fields.getfirst(f)
368
374
        if val is not None:
369
375
            update[f] = val
370
376
        else:
371
377
            pass
 
378
 
 
379
    if 'password' in update:
 
380
        try:
 
381
            authenticate.authenticate(login, oldpassword)
 
382
        except AuthError:
 
383
            req.headers_out['X-IVLE-Action-Error'] = \
 
384
                urllib.quote("Old password incorrect.")
 
385
            req.status = req.HTTP_BAD_REQUEST
 
386
            return
 
387
 
372
388
    update['login'] = login
373
389
 
374
390
    db = common.db.DB()